1

Is there a command directly in the QGIS field calculator that is equivalent to Excel's SUMIF (without exporting to a CSV file)?

I want to check whether the sum of items in the attribute table which fulfill a specific condition (same ID) is above or below a certain treshold.

=SUMIF(RANGE,CRITERIA,[SUM_RANGE])

4
  • Thank you for your answer. I have more than 70,000 rows in my dataset and expoting and importing data may take a lot of time. Is there a way to do this directly in QGIS' field calculator?
    – Stücke
    Commented Feb 22, 2018 at 8:38
  • 1
    The above duplicate question does what you want. You can use aggregate function in field calculator in QGIS 2.18 or you can use GroupStats plugin if you are using QGIS less than 2.18.
    – ahmadhanb
    Commented Feb 22, 2018 at 8:43
  • Thank you for your response. The aggregate sum function in QGIS is as follows: sum(expression, group_by, filter). How excatly does that relate to the excel command? In Excel I would use for my dataset '=SUMIF(RANGE - FID_Consum, ROW - FID_Consum, RANGE - Shape_Area)'; i tried the following in QGIS but it does not work: =SUM("FID_Consum", group_by:="FID_Consum", "Shape_Area")
    – Stücke
    Commented Feb 22, 2018 at 8:53
  • Sorry, I think I got that ... it would be: sum("Shape_Area",group_by:="FID_Consum")? ... but then it says "could not add field to the provider" and the result is higher than the maximum possible value
    – Stücke
    Commented Feb 22, 2018 at 8:58

0

Browse other questions tagged or ask your own question.