#
Sum

Returns the sum of a numeric expression evaluated over a set.

If a numeric expression is specified, the specified numeric expression is calculated for each set member and then sum of all these results is returned. If a numeric expression is not specified, the specified set is evaluated in the current context of the members of the set and then summed.

## Syntax

Sum( Set_Expression , Numeric_Expression )

## Arguments

Set_Expression | MDX expression that returns a set. |
---|---|

Numeric_Expression | MDX expression that returns a number. |

## Examples

Following example calculates cumulative amount of resolved issues over time.

Sum( -- set of previous time periods until selected time period {PreviousPeriods([Time].CurrentHierarchyMember),[Time].CurrentHierarchyMember}, -- numeric expression [Measures].[Issues resolved] )

## See also

- Calculated measures with aggregate functions
- Add cumulative sum from standard calculations
- Function Aggregate()
- Function Avg()
- Import numeric fields as measures to calculate totals automatically
- Example calculation in Resolution days (lead time) reporting