Type: Function
Function: SUM_CUMULATIVE
Syntax: SUM_CUMULATIVE(field or expression)
Description: Returns a cumulative sum of values for each grouping, which takes into account the sum of previous groupings. The return values of this aggregator therefore depend on the sort order of the groupings (ascending or descending).
Important: requires sorting on a dimension
The SUM_CUMULATIVE
operator requires sorting your data on a dimension column. Sorting your data on a metric (e.g. another COUNT
column) will result in incorrect results for the cumulative operator.
Sample usage:
SUM_CUMULATIVE(lines_changed)
returns the cumulative sum of lines of code changed, based on the requested sort-order.ROUND(SUM_CUMULATIVE(lines_changed) / SUM_TOTAL(lines_changed), 2) * 100
returns the percentage of lines of code changed up until this point (e.g. from the beginning of the period up until this month) in comparison to the grand total.ROUND(SUM(lines_changed) / SUM_CUMULATIVE(lines_changed), 2) * 100
returns the percentage of lines of code changed by each grouping in comparison to the total up until this point.