[Qgis-user] error on counting inside a map

Dario C dario955i at gmail.com
Thu May 27 00:52:00 PDT 2021


Hi,
I'm trying to have a legend on my layout and I'd like to count the item
shown in the legend which are inside the map extent.

I'm using this expression but:
case 1) it gives me the total amount of the items (not filtered by map)
case 2) it gives me the total amount of the items shown in the map, but not
filtered by field


case 1:

aggregate( *'LAYERID*','count',"*KEY-FIELD*","*SPECIFIC-FIELD*" is not
null, intersects($geometry,map_get(item_variables('Mappa1'),'map_extent')))

result: 1965 (the same of the total *"SPECIFIC-FIELD" is not null* in the
project (not in the map)


case 2

aggregate( '*LAYERID*','count',"*SPECIFIC-FIELD*" is not null,
intersects($geometry,map_get(item_variables('Mappa1'),'map_extent')))

result: 583 (total amount of the items in the map, but not of that specific
category)


Difference between Case 1 and Case 2 is that case 2 has not "filtered by"
values in the formula.


Thank you for your support.


Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210527/9ec9a270/attachment.html>


More information about the Qgis-user mailing list