Cumulate
arithmetic-functions cumulate
syntax
- cumulate(a)
- cumulate(a, relation)
definition
- cumulate(a) results in an attribute with the cumulation of the non null values of attribute a.
- cumulate(a, relation) results in an attribute with the cumulation of the non null values of attribute a, grouped by the relation. The domain-unit of the resulting attribute is the values unit of the relation attribute.
description
- For domain units with index-numbers starting from 0 (default), cumulate(const(1, domainunit, uint32)) - 1 is synonym for id(domain unit). It is advised to use the id function in such a case.
- There is no id(domainunit, relation) function, use cumulate(const(1, domainunit, uint32), relation) - 1 to calculate index numbers for each entry in the relation domain.
applies to
- Attribute a with Numeric value-type
- Relation 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 unit of arguments a and relation must match.
since version
6.061
example
1. attribute<uint32> cumulateNrInh (City) := cumulate(City/NrInhabitants);
2. attribute<uint32> cumulateNrInhRegion (City) := cumulate(City/NrInhabitants, City/Region_rel);
City/NrInhabitants | City/Region_rel | cumulateNrInh | cumulateNrInhRegion |
---|---|---|---|
550 | 0 | 550 | 550 |
525 | 1 | 1075 | 525 |
300 | 2 | 1375 | 300 |
500 | 1 | 1875 | 1025 |
200 | 3 | 2075 | 200 |
175 | null | 2250 | null |
null | 3 | 2250 | 200 |
domain City, nr of rows = 7