1

I have in QGIS 3.28 points and polygon layer. I want to create virtual field that SUM on the point layer all the specific values the points intersecting in the polygon that are filtered according to the specified parameter (type_of_value). There are at point layer several types of features, I want to add only one type of features to SUM values. This expression at polygon layer SUM all the values in the intersecting polygon layer.

aggregate(
layer:='points_layer', 
aggregate:='sum', 
expression:="values_to_sum", 
filter:=intersects( $geometry, geometry(@parent) )
)

One filter is missing in this expression ... type_of_value

3
  • 1
    filter:=intersects( $geometry, geometry(@parent) ) AND "type_of_value" = 'my_parameter' ? Commented Jun 9, 2023 at 9:25
  • 1
    thank you, it is working ... I tried 'type_of_value' instead of "type_of_value" ... and error?
    – Rii Pii
    Commented Jun 9, 2023 at 9:55
  • A name in double quotes " refers to a fieldname and returns the value stored in this field/atrribute. A name in single quotes ' is interpreted as a string and returns the exact string (characters) inside the quotes.
    – Babel
    Commented Jun 9, 2023 at 11:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.