Returns the sum of values of tuples in a set.
Syntax
Sum ( set [,numeric_value_expression ] )
Parameter | Description |
---|---|
The set containing the tuples to aggregate. If empty, the return value is #MISSING. | |
numeric_value_expression | Optional. An expression that returns a value. Commonly used to restrict the aggregation to a slice from a Measures dimension (see MDX Grammar Rules). In the example below, [Measures].[Total Expenses] is the numeric value expression provided to the Sum function. |
Notes
For each tuple in set, the numeric value expression is evaluated in the context of that tuple and the resulting values are summed up.
The return value of Sum is #MISSING if either of the following is true:
The input set is empty.
All tuple evaluations result in #MISSING values.
Example
WITH MEMBER [Market].[Sum Expense for Main States] AS 'Sum ({[Market].[California], [Market].[Colorado], [Market].[Texas], [Market].[Illinois], [Market].[Ohio], [Market].[New York], [Market].[Massachusetts], [Market].[Florida]}, [Measures].[Total Expenses] )' SELECT {[Measures].[Total Expenses]} ON COLUMNS, {UDA([Market], "Major Market"), [Market].[Sum Expense for Main States]} ON ROWS FROM Sample.Basic WHERE ([Scenario].[Actual])
returns the grid:
(axis) | Total Expenses |
---|---|
New York | 8914 |
Massachusetts | 3412 |
Florida | 5564 |
East | 25310 |
California | 11737 |
Texas | 4041 |
Illinois | 6900 |
Ohio | 5175 |
Colorado | 6131 |
Central | 34864 |
Sum Expense for Main States | 51874 |