Skip to main content
Version: I2022.3.0

Aggregate

Returns a number that is calculated by aggregating over the cells returned by the set expression. If a numeric expression is not provided, this function aggregates each measure within the current query context by using the default aggregation operator specified for each measure. If a numeric expression is provided, this function first evaluates, and then sums, the numeric expression for each cell in the specified set. The numeric expression must contain an existing AtScale measure or calculated measure that has been defined in Design Center (ad-hoc measures are not supported).

Syntax

Aggregate(Set_Expression [ ,Numeric_Expression ])

Notes

The Aggregate function in AtScale works with the aggregation functions listed below. Using other aggregation functions with Aggregate results in an error.

  • Sum: Returns the sum of values over the set.
  • Min: Returns the minimum value over the set.
  • Max: Returns the maximum value over the set.
  • Count: Returns the number of cells over the set.

Input Parameters

Set_Expression
An MDX expression that returns a set.

Numeric_Expression
An MDX expression that contains an existing AtScale measure or calculated measure that has been defined in Design Center (ad-hoc measures are not supported).

Examples

This expression calculates the aggregate of all internet sales of the year previous to the current year to date:

Aggregate(
PeriodsToDate(
[Order Date Dimension].[Order Retail445].[Order Reporting_Year],
ParallelPeriod(
[Order Date Dimension].[Order Retail445].[Order Reporting_Year],
1,
[Order Date Dimension].[Order Retail445].CurrentMember
)
),
[Measures].[salesamount1]
)