Timeline for Total/sum multiple fields and group by in QGIS
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 21 at 19:15 | history | became hot network question | |||
Jun 21 at 14:39 | history | edited | BKS | CC BY-SA 4.0 |
edited title
|
Jun 21 at 14:37 | comment | added | BKS |
Thank you @bera. I tried this but my problem is I do not know how many columns I will have in my table. My table will have one grouping variable field and it can have any number of numeric fields> i cannot find a suitable sql query to ask select groupingfield, sum(all_columns) from mylayer group by grouping_field .
|
|
Jun 21 at 13:44 | comment | added | Bera |
It is possible to create a virtual layer using SQL, like: SELECT groupfield1, groupfield2, sum(col1), sum(col2), sum(col3) FROM mylayer GROUP BY groupfield1, groupfield2
|
|
Jun 21 at 13:38 | comment | added | Babel |
Adding multiple fields to Field(s) with categories is possibly by default, I don't know why you ask about that. Did you have a close look at how this tool works? To calculat multiple statistics for several different fields at once (Field to calculate statistics on ), use batch mode: see my answer.
|
|
Jun 21 at 13:34 | answer | added | Babel | timeline score: 2 | |
Jun 21 at 13:31 | comment | added | Erik |
So you could run sum() for each column?
|
|
Jun 21 at 12:20 | comment | added | BKS | I edited the question. @Erik, sum works for one field. I wish to summarize multiple fields. In fact I wish to total all columns except the grouping variable. | |
S Jun 21 at 12:18 | history | edited | BKS | CC BY-SA 4.0 |
added 246 characters in body
|
Jun 21 at 12:04 | review | Close votes | |||
Jul 8 at 3:04 | |||||
Jun 21 at 11:54 | review | Suggested edits | |||
S Jun 21 at 12:18 | |||||
Jun 21 at 11:42 | comment | added | Babel |
Sorry, your question is not clear to me. What is your problem? You have one or two fields for grouping in the attribute table? And what exactly does not work in statistics by category tool? Please use the right terminology of the tool, otherwise we don't understand you: in the tool, you have Field to calculate statistics on and Field(s) with categories : so what are you speaking about? Please edit your initial question, otherwise it risks to be closed.
|
|
Jun 21 at 11:25 | history | edited | Vince | CC BY-SA 4.0 |
naming
|
Jun 21 at 11:22 | comment | added | Erik |
Have you tried the sum() expression?
|
|
S Jun 21 at 11:12 | review | First questions | |||
Jun 21 at 13:29 | |||||
S Jun 21 at 11:12 | history | asked | BKS | CC BY-SA 4.0 |