Once you're in the aggregate()
command it only focuses on the layer you're aggregating, so you can't reference the atlas layer field normally with just double quotes (it thinks that's on the aggregated layer).
To tell it you are talking about a field in the atlas layer, try referring to the atlas layer specifically using @atlas_feature
and attribute()
. Note that the field is referred to with single quotes and is case-sensitive
aggregate('layer_to_aggregate','count',"field_from_layer_to_aggregate_to_aggregate",
"field_from_layer_to_aggregate_to_filter"=
attribute(@atlas_feature,'field_from_atlas_layer'))
filter:= "field_from_atlas_layer"
?. The problem is the aggregate function don't understand
"field_from_atlas_layer"` to be the atlas layer and I think inside the aggregate function every fields are supposed to be from the'layer_to_aggregate'
.