I have a grid-layer (polygon) and a point-layer. The points that lay within a grid-cell have the same unique id like the grid cell. they also have an attribute "year". What I want is to create a column in the table of the grid layer that is populated with the number of unique values from the attribute "year" from the point-layer (only of points that lie within the respective cell). So in the screenshot-example, for the upper cell that would be "6" (2014,2015,2016,2017,2018,2019), for the lower it would be just "1" (2 x 2017, so only one unique value), and so on.
In the field calculator I can only find
within_geom_sum, but nothing like
within_geom_unique or similar.
I also have found a workaround using the "group stats" add on, where I can count the unique values, and then join the produced csv with the grid layer, but I'm pretty sure that there is some easy way to do it directly in the field calculator without these extra steps.