CumulativeTimeSum (PQL)
Executes cumulative sum aggregation over time on a column of data from the model. The column must contain numerical data for it to be functional.
- Returned Output: Numeric
- Library: PQL \ Semantic \ Aggregate
- Version: 2023.00.000
- Compatibility: Pyramid Query Language (PQL) data sources
Syntax
* Click on the function's arguments above for more details on the input values.
Comments
- The "measure" column needs to be the name of the column in the model [table].[column name] or it can be an existing measure in the model [measures].[column name].
- For details on how to employ and use this function see the granular calculation overview.
Different Function types
- This function is like the SQL count function; calculating the count of items in a column of data in your query or model.
- If you wish to find the count for the elements in a specified SET or LIST from a hierarchy, use this semantic function. All counts are always distinct.
- To use a simple count mathematical operation on a list of numbers, use the Common library function.
The CumulativeTimeSum function calculates a running or cumulative total over time. This function is typically used in time series analysis, where you want to aggregate values over a period of time, such as cumulative sales, cumulative costs, or any other metric that builds up over time.
Parameters
- measure: The measure you want to calculate the cumulative sum for (e.g., sales, profit, quantity).
- The function computes the cumulative total by summing the values up to the current time period, including the current period's value.
Examples
CumulativeTimeSum([measures].[Data Sales])
You can see the effect from this example snippet in column #2 to #4 – Cumulative Sales, based on the month name column in position #1.
Note: The function does not require a date field to be defined, it will work on any date field displayed in the Discovery.