Hi Dario, You want two filters: a field not being null and features being visible. But none of your expressions indicates that. Naming parameters could help you avoid falling in this trap (read the tip just above this section <https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/expression.html#some-use-cases-of-expressions> in the docs) try with aggregate( *'LAYERID*','count',"*KEY-FIELD*","*SPECIFIC-FIELD*" is not null *AND* intersects($geometry,map_get(item_variables('Mappa1'),'map_extent')))
Hope that helps, Harrissou Le jeu. 3 juin 2021 à 11:38, Dario C <[email protected]> a écrit : > > Sorry, I don't want to spam anybody. I send again my request, just in case > it never has never sent. > Thank you > > > 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 > _______________________________________________ > Qgis-user mailing list > [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user >
_______________________________________________ Qgis-user mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
