Description
Cumulates each item of a list using its ordering
Syntax
CUMULATE(Number, Cumulated Dimension n, Group Dimension] ], Aggregation])
-
first parameter
Number
can be a Metric or a List Property -
Cumulated Dimension
, list according to which cumulation is made, should be one of the Dimension of the first parameter -
Group Dimension
is a list that resets the accumulation (optional) -
Aggregation
SUM, AVG, MIN, MAX (optional)
Return type
number
Examples
Case | Results | Return Type |
| cumulates 10 on each month starting from the first period of the calendar (ex. Jan 20: 10, Feb 20: 20, Mar 20: 30, etc.) |
|
| cumulates the metric |
|
| cumulates the metric |
|
| averages the metric |
|
Use ON operator with CUMULATE
You can use the ON operator to change the order of accumulation in the CUMULATE function. An example of how to do this is is provided below, this Metric is dimensioned by Vacuum Cleaner and represents inventory:
CD001 Inventory | |
---|---|
Vacuum Cleaner A | 30 |
Vacuum Cleaner B | 48 |
Vacuum Cleaner C | 24 |
If you were to create a new Metric dimensioned by the Vacuum Cleaner Dimension, you could accumulate the values by using the CUMULATE function. The default formula looks like this:CUMULATE(CDO01 Inventory, ‘Vacuum Cleaner’)
And the output looks like:
![](https://uploads-eu-west-1.insided.com/pigment-en/attachment/892ae0c4-be11-4550-aeb7-792d6ea3c0dd.png)
However, you can change the order in which the values are accumulated by referencing an integer Property in the formula. Check out the Priority Property in the Vacuum Cleaner Dimension below.
![](https://uploads-eu-west-1.insided.com/pigment-en/attachment/258230d9-984c-4352-88a2-be7f6badde8d.png)
You can change the order of the accumulation by using the ON operator as follows:
CUMULATE(CDO01 Inventory, ‘Vacuum Cleaner’ on ‘Vacuum Cleaner’.Priority)
Remember to include the ON operator in the second argument of the function. This helps you determine the closing balance after fulfilling sales orders.
See the output below:
![](https://uploads-eu-west-1.insided.com/pigment-en/attachment/dc8ba25f-bbb6-4258-ba48-e8403f1c9c65.png)
The inventory is now being accumulated in the order of the Priority Property.
Excel equivalent: None
See also: DECUMULATE