CumulativeSum
DataWindow expression function
Description
Calculates the total value of the rows up to and including the
current row in the specified column (a running total).
Syntax
|
1 |
CumulativeSum ( column { FOR range } ) |
|
Argument |
Description |
|---|---|
|
column |
The column for which you want the cumulative total |
|
FOR range (optional) |
The data that will be included in the cumulative sum.
For Crosstabs, specify CROSSTAB for
For Graph and OLE objects, specify one of
|
Return value
The appropriate numeric datatype. Returns the cumulative total value
of the rows.
Usage
If you specify range, CumulativeSum restarts the accumulation at the
start of the range.
For graphs and OLE objects, you do not select the range when you
call the function. The range has already been determined by the Rows
setting on the Data property page (the Range property), and the
aggregation function uses that range. Settings for Rows include the
following:
-
For the Graph or OLE presentation style, Rows is always
All. -
For Graph controls, Rows can be All, Page, or Group.
-
For OLE controls, Rows can be All, Current Row, Page, or Group.
The available choices depend on the layer the control occupies.
In calculating the sum, null values are ignored.
Examples
This expression returns the running total for the values that are
not null in the column named salary:
|
1 |
CumulativeSum(salary) |
This expression returns the running total for the values that are
not null in the column named salary in group 1:
|
1 |
CumulativeSum(salary for group 1) |
This expression entered in the Value box on the Data property page
for a graph returns the running total for the salary column for the values
in the graph that are not null:
|
1 |
CumulativeSum(salary for graph) |
This expression in a crosstab computed field returns the running
total for the salary column for the values in the crosstab that are not
null:
|
1 |
CumulativeSum(salary for crosstab) |
See also