Skip to main content Skip to complementary content

RangeAvg - script and chart function

RangeAvg() returns the average of a range. Input to the function can be either a range of values or an expression.

Syntax:  

RangeAvg(first_expr {, Expression})

Return data type: numeric

Arguments:  

The argument expressions of this function may contain inter-record functions with a third optional parameter, which in themselves return a range of values.

Argument Description
first_expr The expression or field containing the data to be measured.
Expression Optional expressions or fields containing the range of data to be measured.

Limitations:  

If no numeric value is found, NULL is returned.

Examples and results:  

Examples Results
RangeAvg (1,2,4)

Returns 2.33333333

RangeAvg (1,'xyz') Returns 1
RangeAvg (null( ), 'abc') Returns NULL

Example with expression:

RangeAvg (MyField, Above(MyField), Above(Above(MyField)))

Returns a sliding average of the result of the range of three values ofMyField calculated on the current row and two rows above the current row.

Data used in examples:

MyField RangeAvg (Above(Above(MyField), Above(Above(MyField)))
10 10
2 6
8 6.666666667
18 9.333333333
5 10.33333333
9 10.66666667

RangeTab:

LOAD * INLINE [

MyField

10

2

8

18

5

9

] (delimiter is '|');

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!