I have a shapefile that contains building footprints with multiple addresses with different functions (with each an usable area). I would like to calculate the sum of the usable area, per building "id"
, per same "function"
, as such:
id | function | area |
---|---|---|
1 | wo | 10 |
1 | wi | 2 |
2 | wo | 50 |
1 | wo | 10 |
↓ calculate sum (area) when same id and same function
id | function | area |
---|---|---|
1 | wo | 20 |
1 | wi | 2 |
2 | wo | 50 |
I tried to use the following expression:
sum(expression [,group_by] [,filter])
But the group_by()
is only possible once (for instance to group the "id"
).
How can we calculate the sum of the two features only when these have the same "id"
and same function?