<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Sorry, I don't want to spam anybody. I send again my request, just in case it never has never sent.</div><div class="gmail_attr">Thank you</div><br><br><div dir="ltr">Hi,<div>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.</div><div><br></div><div>I'm using this expression but:</div><div>case 1) it gives me the total amount of the items (not filtered by map)</div><div>case 2) it gives me the total amount of the items shown in the map, but not filtered by field</div><div><br></div><div><br></div><div>case 1:</div><div><p style="margin:0px;white-space:pre-wrap">aggregate( <i>'LAYERID</i>','count',"<i>KEY-FIELD</i>","<i>SPECIFIC-FIELD</i>" is not null, intersects($geometry,map_get(item_variables('Mappa1'),'map_extent')))</p><p style="margin:0px;white-space:pre-wrap">result: 1965 (the same of the total *"SPECIFIC-FIELD" is not null* in the project (not in the map)

</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">case 2</p><p style="margin:0px;white-space:pre-wrap">aggregate( '<i>LAYERID</i>','count',"<i>SPECIFIC-FIELD</i>" is not null, intersects($geometry,map_get(item_variables('Mappa1'),'map_extent')))<br></p><p style="margin:0px;white-space:pre-wrap">result: 583 (total amount of the items in the map, but not of that specific category)</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Difference between Case 1 and Case 2 is that case 2 has not "filtered by" values in the formula.</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Thank you for your support.</p><p style="margin:0px;white-space:pre-wrap"><br></p><p style="margin:0px;white-space:pre-wrap">Cheers</p></div></div>
</div></div>