Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Returns a number that is calculated by aggregating over the members returned by the set expression. If a numeric expression is provided, this function first evaluates and then sums the numeric expression for each cell in the specified set.

If a numeric expression is not provided, this function aggregates each member within the current query context by using the default aggregation operator that is specified for each measure.

Syntax

Code Block

...

Aggregate(Set_Expression [ ,Numeric_Expression ])

Arguments

Set_ExpressionMDX expression that returns set.
Numeric_ExpressionMDX expression that returns number.

Examples

By default members are ordered by name. Aggregated set of members can be used to rearrange order in which members are displayed. For example to reorder Account dimension and have "Expense" as first member and see "Asset" after it add Account calculated member as follows:

Code Block
Aggregate({

...


[Account].[Expense],

...


[Account].[Asset]

...


})

Select this member and drill into to see individual aggregated members.

...

Following example returns invoice amount from 13 months ago to current data.

Code Block
aggregate({ [Measures].[Invoice amount],

...


[Time].[Month].DateMember('13 month ago'):

...


[Time].[Month].CurrentDateMember}

...


)