2.341.7.5 Aggregate Function: Sum

The following are the arguments, types, and specification of the Sum aggregate function.

Function

Arguments

Type

Specification

Sum

Return

Float

Returns the sum of all values of the expression within the scope.

Return type is decimal for decimal* expressions and double for all other expressions.

Expression

Numeric

The expression to aggregate. MUST NOT contain the First, Last, Previous, or RunningValue functions. MUST NOT reference other aggregate functions unless their Scope is the same as, or a child scope of, this function's Scope. For all distinct scopes directly** referenced in the expression, there MUST be one scope that has all other scopes as its ancestor.

Aggregate functions in the page header or page footer with an omitted Scope parameter MUST NOT contain any aggregate functions.

Aggregate functions with the name of a dataset as its Scope parameter MUST NOT contain any aggregate functions.

Scope

String

Name of a dataset or the name of a group or data region that contains (directly or indirectly) the report item that the aggregate function is used in. Specifies that the aggregate applies to the entire dataset, all of the data in the current group, or all of the data in the current data region. MUST be a constant, not an expression. See also Scope.

Recursive

Enum

Recursive | Simple (Default).

Specifies whether the aggregate is calculated recursively. Optional. See also Recursive.

* Decimal and double refer to CLR data types in this context.

** Directly referenced aggregate functions are contained within the Expression argument but are not contained within a nested aggregate or the Destination or Result arguments to a Lookup function.