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
    Jun 11 '20 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
    Jun 11 '20 at 15:30
  • So you are trying to get for each ID variable1 + variable 2 ?
    – Baswein
    Jun 11 '20 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
    Jun 11 '20 at 15:44

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
    Jun 11 '20 at 18:49
  • Glad to help out!
    – Baswein
    Jun 11 '20 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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