Tuple Expressions

AtScale supports simple cube-sided tuple expressions for calculated measures.

Specifying Members

If an All member exists, that is the default member for every attribute hierarchy unless explicity specified otherwise.

When you do explicitly specify members, parentheses are optional for specifying any single member in a tuple. However, you must include the entire tuple in parentheses to explicitly specify a member in a tuple from more than one dimension.

Reference Other Tuple Expressions

Tuple expressions that use the [Measure] dimension can reference other calculated measures. For example, the calculated measure CityTaxRate could be referenced in another calculated measure, SanMateoTaxRate, by the expression ([City].[San Mateo], [Measures].[CityTaxRate]).

Tuple expressions can reference calculated measures that include tuple expressions from other calculated measures. As an example, let's say the expression for calculated measure SanMateoTaxRate is ([City].[San Mateo], [Measures].[CityTaxRate]) and the expression for SanFranciscoTaxRate is ([City].[San Francisco], [Measures].[CityTaxRate]). Given that, the following expression for the calculated measure MeanBayAreaTaxRate is valid: ([Measures].[SanMateoTaxRate] + [Measures].[SanFranciscoTaxRate]) / 2

Use MDX Functions

You can use tuple expressions in mathematical operations and other MDX functions.

The CurrentMember, PrevMember, NextMember, Lead, and Lag functions can all be used as tuple coordinate components.

Consider that the CurrentMember function can be used on a maximum of 2 dimensions in a single tuple expression.

Miscellaneous Notes

Dimension order in the tuple expression does not matter. For example, ([Product].[iPhone10], [Measures].[Revenue]) is the same as ([Measures].[Revenue], [Product].[iPhone10]).

AtScale supports key-based and name-based member references in tuple expressions. For example, [Product].&[25] or [Product].[iPhone10] are valid references.

Tuple expressions with more than one dimension

AtScale supports tuple expressions with more than one dimension (n-dimension-tuples > 1). The following are examples of supported and unsupported expressions.

Supported Tuple Expressions with > 1 Dimension

  • Multiple Static Dimension Constraints.

    For example, Sales of Product Line "M" in the Country of France:

    ([Geography Dimension].[Geography City].[CountryCity].&[France],
    [Product Dimension].[Product Dimension].[Product Line].&[M ], [Measures].[salesamount1])
  • Multiple Static Dimension Constraints and a Single Dynamic Constraint.

    Dynamic Constraint refers to the use of relative member navigation functions such as CurrentMember, Lag, ParallelPeriod, and etc. For example, the following expression is supported. Sales of Product Line "M" in the Country of France in the Previous Period:

    ([Geography Dimension].[Geography City].[CountryCity].&[France],
    [Product Dimension].[Product Dimension].[Product Line].&[M ],
    [Order Date Dimension].[Order Retail445].CurrentMember.PrevMember, [Measures].[salesamount1])

    Or Sales of Product Line "M" in the Country of France for the same period of the previous Year:

    ([Geography Dimension].[Geography City].[CountryCity].&[France],
    [Product Dimension].[Product Dimension].[Product Line].&[M ],
    ParallelPeriod([Order Date Dimension].[Order Retail445].[Order Reporting_Year],1, [Order Date Dimension].[Order Retail445].CurrentMember),
    [Measures].[salesamount1])
  • Tuple expressions that use dimensional modification on more than one dimension; for example:

    ([DateCustom].[Retail445].currentMember.lag(1),
    [DateCustom].[StandardMonth].currentMember.lag(1), [Measures].[Internet Order Count])

Unsupported Tuple Expressions with > 1 Dimension

  • Tuple expressions with nested dynamic constraints such as nested Lag and ParallelPeriod functions.

    For example, Sales of Product Line "M" ordered a year prior to 3 periods ago is not supported:

    ( [Product Dimension].[Product Dimension].[Product Line].&[M ],
    ParallelPeriod([Order Date Dimension].[Order Retail445].[Order Reporting_Year],1, [Order Date Dimension].[Order Retail445].CurrentMember.Lag(3)),
    [Measures].[salesamount1])

Unsupported Tuple Expressions

AtScale does not support the following:

  • Dynamic expressions in tuple slicers are not supported.

  • Expressions that attempt to use different grains of the same hierarchy in a calculation.

    If an identifier is used without selecting it as unique, it could result in ambiguous or incorrect data.

    For example, the following expression is unsupported because different grains of the geography hierarchy are used in the numerator and denominator:

    ([Geo].[Country].CurrentMember, [Measures].[SumOfSales]) / ([Geo].[Country].[All], [Measures].[SumOfSales]) * 100
  • Creating a tuple calculated measure that uses an identifier, without selecting the identifier as unique.

    For example, the following tuple would not be allowed if the model doesn't have the Contains Unique Names checkbox selected.

    ([Color].[Color].[Color].[Blue], [Measures].[Order Quantity])

    Similarly, the following tuple would not be allowed if the model doesn't have the Unique checkbox under the Key Column select box selected.

    ([Color].[Color].[Color].&[Blue], [Measures].[Order Quantity])

See Also

The Microsoft MDX reference documentation for tuple expressions is located here.