3

I want to create an expression in the QGIS 3.28 dashboard layer that counts points on a specific point_layer and with a specific value that is displayed in the current map_extent view

aggregate(
   layer:='point_layer', 
   aggregate:='count', 
   expression:="field1", 
   filter:="field1"='3' AND within(.. ???.. )
   )
Taras
  • 32,823
  • 4
  • 66
  • 137
Rii Pii
  • 425
  • 2
  • 12

1 Answers1

3

The @map_extent variable returns the current extent:

aggregate(
   layer:='point_layer', 
   aggregate:='count', 
   expression:="field1", 
   filter:="field1"='3' AND within(@geometry, @map_extent)
   )
Taras
  • 32,823
  • 4
  • 66
  • 137
webrian
  • 2,171
  • 14
  • 13