RangeSum - script and chart function
RangeSum() returns the sum of a range of values.All non-numeric values are treated as 0, unlike the + operator.
Syntax:
RangeSum(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:
The RangeSumfunction treats all non-numeric values as 0, unlike the + operator.
Examples and results:
| Examples | Results |
|---|---|
| RangeSum (1,2,4) |
Returns 7 |
| RangeSum (5,'abc') | Returns 5 |
| RangeSum (null( )) |
Returns 0 |
Example with expression:
RangeSum (Above(Sum(MyField),0,3))
Returns the sum of the three results of the Sum(MyField) function evaluated over the current row and two rows above the current row.
Data used in examples:
| MyField |
Sum(MyField) |
RangeSum(Above(Sum(MyField),0,3)) |
|---|---|---|
| 10 |
10 |
10 |
| abc | 0 | 10 |
| 8 | 8 | 18 |
| def | 0 | 8 |
| xyz | 0 | 8 |
| 9 | 9 | 9 |