running-total
Returns a running total by row (including the current row) for a set of values. The "<for-option>" defines the scope of the function. The "at" option defines the level of aggregation and can be used only in the context of relational datasources.
Syntax
running-total ( numeric_expression [ at expression { ,
expression } ] [ <for-option> ] [ prefilter ] )
running-total ( numeric_expression [ <for-option> ] [ prefilter ] )
<for-option> ::= for expression { , expression }|for report|auto
Example
running-total ( Qty )
Result
For each row, returns the quantity and a running total of the current and previous rows.
Result data
Name | Qty | Total | Running-Total (Qty) for name |
---|---|---|---|
Smith | 2 | 18 | 2 |
Smith | 3 | 18 | 5 |
Smith | 6 | 18 | 11 |
Smith | 7 | 18 | 18 |
Wong | 3 | 12 | 3 |
Wong | 5 | 12 | 8 |