moving-total
Returns a moving total by row for a specified set of values over a specified number of rows. 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
moving-total ( numeric_expression , numeric_expression [ at
expression { , expression } ] [ <for-option> ] [ prefilter ] )
moving-total ( numeric_expression , numeric_expression
[ <for-option> ] [ prefilter ] )
<for-option> ::= for expression { , expression }|for report|auto
Example
moving-total ( Qty , 3 )
Result
For each row, returns the quantity and a moving total of the current row and the preceding two rows.
Result data
Qty | Moving-Total (Qty, 3) |
---|---|
200 | 200 |
700 | 900 |
400 | 1300 |
200 | 1300 |
200 | 800 |
500 | 900 |