syntax
- sum(a)
- sum(a, relation)
definition
- sum(a) results in a parameter with the sum of the non null values of attribute a.
- sum(a, relation) results in an attribute with the sum of the non null values of attribute a, grouped by the relation attribute.The domain unit of the resulting attribute is the values unit of the relation attribute.
applies to
Attribute a with Numeric value typeRelation attribute with value type of the group CanBeDomainUnit
conditions
The values unit of the resulting data item should match with regard to value type and metric with the values unit of attribute a.The domain of argument a and relation must match.
since version
5.15
example:
parameter<uint32> sumNrInh := sum(City/NrInhabitants); result = 2250
attribute<uint32> sumNrInhRegion (Region)
:= sum(City/NrInhabitants, City/Region_rel);
City/NrInhabitants | City/Region_rel |
550 | 0 |
525 | 1 |
300 | 2 |
500 | 1 |
200 | 3 |
175 | null |
null | 3 |
sumNrInhRegion |
550 |
1025 |
300 |
200 |
0 |