Why doesn't the filter work (4th variable passed into the aggregate function) when I try to use in the field calculator an expression of this type:
aggregate('Layer', 'sum', "Field1" , "Field2" = attribute($currentfeature, 'Field2'))
It returns the total sum of "Field1"
rather than applying the filter.
In the aggregate function, such a filter seems to be always true, while by itself, it works.
Is it not possible to use feature-based expressions with the aggregate function, or can it work if I modify the expression?