#
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.

Before you create the calculated measure with the average function, check if you can use standard functionality to add statistical calculations.

## Syntax

Sum(Set_Expression, Numeric_Expression)

## Arguments

Set_Expression | MDX expression that returns a set for which the sum will be found. |
---|---|

Numeric_Expression | MDX expression that returns a number that will be summed up across the set. |

## Examples

The following example calculates the 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