Cumulative functions
Cumulative formulas are aggregate formulas. Cumulative formulas that allow you to calculate the average, max, min, or sum or your data over time. Although we usually talk about cumulative formulas over time, you can use them over any other sequential data. Each of the cumulative formulas accepts a measure and one or more optional grouping by an attribute (like region or department):
formula (measure, [attribute, attribute, ...])
Only the measure value is required. If you supply both a measure and attributes, the formula returns the aggregate of the measure accumulated by the attribute(s) in the order specified. You should experiment with only a measure and then with an attribute to see which output best meets your use case.
The cumulative formulas are:
Function | Description |
---|---|
|
Takes a measure and one or more attributes. Returns the average of the measure, accumulated by the attribute(s) in the order specified. For example: |
|
Takes a measure and one or more attributes. Returns the maximum of the measure, accumulated by the attribute(s) in the order specified. For example: |
|
Takes a measure and one or more attributes. Returns the minimum of the measure, accumulated by the attribute(s) in the order specified. or example: |
|
Takes a measure and one or more attributes. Returns the sum of the measure, accumulated by the attribute(s) in the order specified. For example: |
Calculate a cumulative sum
This example demonstrates using the cumulative_sum formula, also known as a running total. To use the cumulative function in a search:
-
Start a new search.
-
In the upper-right side of the table, click the ellipses icon and select Add formula.
-
Enter the cumulative_sum formula, providing a measure and one or more attributes.
The example will return the sum of revenue, accumulated by the commit date.
-
Name the formula by clicking its title and typing a new name.
-
Click Save.
The formula will appear in the search bar and in the table as its own column.
A headline box displaying the cumulative sum within the entire table will appear at the bottom. You can click it to toggle between different aggregations.