I'm trying to sum multiple variables by categories (id of my polygons) within a QGIS model but I haven't found a proper way to do that...

If I hadn't to use the graphical modeler I would obviously use "Dissolve with stats" but this tool cannot be added within a model...

Is there another way to do such thing without using the python console ?

Here is a picture of the attribute table of my shapefile: enter image description here

  • 1
    I had a similar issue recently gis.stackexchange.com/questions/362559/… I was directed to the aggregate algorithm which works great and is available in the modeler.
    – Baswein
    Commented Jun 11, 2020 at 14:34
  • Hi Baswein ! The "aggregate" tool looks like what I'm looking for indeed ! I tried it but unfortunately, since I'm just learning QGIS, I'm struggling to get the sum of my two variables for each polygons' id
    – Linda
    Commented Jun 11, 2020 at 15:30
  • So you are trying to get for each ID variable1 + variable 2 ?
    – Baswein
    Commented Jun 11, 2020 at 15:40
  • I would like to get for each ID: sum of variable 1, sum of variable 2 (and ideally sum of variable1 + variable2 as well) :)
    – Linda
    Commented Jun 11, 2020 at 15:44

1 Answer 1


Aggregate should do exactly what you want. Original Table original table
Aggregate Setup Aggregate setup Expression for sum of var1 and var2 Expression for sum of var1 and var2 Final Output output The modeler interface will be a little different but try it outside of the modeler first. Also have you looked at the group stats plugin?

  • Thank you very much Baswein ! :)
    – Linda
    Commented Jun 11, 2020 at 18:49
  • Glad to help out!
    – Baswein
    Commented Jun 11, 2020 at 19:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.