running-average
Returns the running average 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-average ( numeric_expression [ at expression { ,
expression } ] [ <for-option> ] [ prefilter ] )
running-average ( numeric_expression [ <for-option> ] [ prefilter ] )
<for-option> ::= for expression { , expression }|for report|auto
Example
running-average ( Qty )
Result
For each row, returns the quantity and a running average of the current and the previous rows.
Result data
Name | Qty | Avg | Running-Average for name |
---|---|---|---|
Smith | 7 | 5 | 7 |
Smith | 3 | 5 | 5 |
Smith | 6 | 5 | 5.33 |
Smith | 4 | 5 | 5 |
Wong | 3 | 4 | 3 |
Wong | 5 | 4 | 4 |