Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions

Transformation Language Reference

Transformation Language Reference

CUME

CUME

Returns a running total. A running total means CUME returns a total each time it adds a value. You can add a condition to filter rows out of the row set before calculating the running total.
Use CUME and similar functions (such as MOVINGAVG and MOVINGSUM) to simplify reporting by calculating running values.

Syntax

CUME(
numeric_value
[,
filter_condition
] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
numeric_value
Required
Numeric datatype. Passes the values for which you want to calculate a running total. You can enter any valid transformation expression. You can create a nested expression to calculate a running total based on the results of the function as long as the result is a numeric value.
filter_condition
Optional
Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value

Numeric value.
NULL if all values passed to the function are NULL, or if no rows are selected (for example, the filter condition evaluates to FALSE or NULL for all rows).
If the return value is Decimal with precision greater than 15, you can enable high precision to ensure decimal precision up to 38 digits.

Nulls

If a value is NULL, CUME returns the running total for the previous row. However, if all values in the selected port are NULL, CUME returns NULL.

Examples

The following sample rowset might result from using the CUME function:
CUME( PERSONAL_SALES )
PERSONAL_SALES
RETURN VALUE
40000
40000
80000
120000
40000
160000
60000
220000
NULL
220000
50000
270000
Likewise, you can add values before calculating a running total:
CUME( CA_SALES + OR_SALES )
CA_SALES
OR_SALES
RETURN VALUE
40000
10000
50000
80000
50000
180000
40000
2000
222000
60000
NULL
222000
NULL
NULL
222000
50000
3000
275000

0 COMMENTS

We’d like to hear from you!