I am trying to build a graphical model. This model takes a vector layer as input. I have the first field as a grouping variable and all remaining fields are numeric. I would like to total each column based on the grouping variable in first field. In some cases, I have first two fields as grouping variable and the rest are numeric.
In 'statistics by category tool', i am able to use only one grouping variable and one field in 'Field to calculate statistics on'. Is it possible to add multiple numeric field to 'Field to calculate statistics on' and multiple categorial(string) variables to 'Field with categories'? Maybe just a syntax issue? I tried with single qoutes and double quoutes around field names and with a comma separating the two fields . But I get error.
Is there any tool within QGIS to acheive this? I am not looking for 'plugin' solutions.
sum()
expression?statistics by category
tool? Please use the right terminology of the tool, otherwise we don't understand you: in the tool, you haveField to calculate statistics on
andField(s) with categories
: so what are you speaking about? Please edit your initial question, otherwise it risks to be closed.sum()
for each column?SELECT groupfield1, groupfield2, sum(col1), sum(col2), sum(col3) FROM mylayer GROUP BY groupfield1, groupfield2