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