I am using QGIS 2.8.3 but also have 3.4 whatever works better for this issue.

I have a bathymetry shapefile and a point layer. One of the columns of the bathymetry vector gives the maximum depth and I display the file by the different depth classes. Now I need to know how many of my points (point layer) are in which depth class. I tried to use the 'points in polygon tool' but it did not work, maybe cause there was no way to indicate which is the relevant column (depth max) cause the attribute table contains quite many columns.

this is well handled using SQL spatial, which can be done on shapefiles in QGIS, or using sqlite or ultimately postgis. but when you say "urgently", does this need to be figured out soon due to life or death, employment deadline, or educational project due date?
– DPSSpatialAug 8 at 0:14

Option 1) Would I need to join the 2 files first? Or Option 2) only need to use the field calculator and with the expression, u mentioned and integrate the layer name of the point layer in it?
– TinaAug 8 at 1:47

Option 2. No need to join the bathymetry layer to the point layer - the aggregate expression has all the info it needs.
– M BainAug 8 at 1:59

Instead of for bathymetry I used the approach you suggested for a substrate layer which is basically the same thing. I replaced 'NameOfPointLayer' with the relevant point layer...the processing took a while and the result is a new column which I named 'distance' but it only shows 0 in each row.
– TinaAug 8 at 11:31