Aggregation of an MDX calculated measure when multiple time periods are selected

  • In my SSAS cube, I have several measures defined in MDX which work fine except in one type of aggregation across time periods. Some don't aggregate (and aren't meant to) but one does aggregate but gives the wrong answers. I can see why, but not what to do to prevent it.

    The table below (originally an Excel pivot table build from the cube) is the simplest case of what goes wrong. In that example, in the Net Lost Commitments column, 23,621 is *not* the grand total of 5,713 and 6,837.

    Active Commitments Acquisitions Net Lost Commitments Growth in Commitments

    2009 88,526 13,185 5,713 7,472

    2010 92,125 10,436 6,837 3,599

    Total 23,621 23,621

    1. Active Commitments works fine. It is calculated for a point in time and should not be aggregated across time periods.

    2. Acquisitions works fine.

    3. [Measures].[Growth in Commitments] = ([Measures].[Active Commitments],[Date Dimension].[Fiscal Year Hierarchy].currentMember) - ([Measures].[Active Commitments],[Date Dimension].[Fiscal Year Hierarchy].prevMember)

    4. [Measures].[Net Lost Commitments] = ([Measures].[Acquisitions] - [Measures].[Growth in Commitments])

    What's happening in the example above is that the total of Net Lost Commitments is calculated from the total of Acquisitions (23,621) minus the total of Growth in Commitments (which is null).

    Aggregation of Net Lost Commitments makes sense and works for non-time dimensions. But I want it to show null when multiple time periods are selected rather than an erroneous value. Note that this is not the same as simply disabling all aggregation on the time dimension. The aggregation of Net Lost Commitment works fine up the time hierarchy -- the screenshot shows correct values for 2009 and 2010, and if you expand to quarters or months you still get correct values. It is only when multiple time periods are selected that the aggregation fails.

    So my question is how to change the definition of Net Lost Commitments so that it does not aggregate when multiple time periods are selected, but continues to aggregate across all other dimensions? For instance, is there a way of writing in MDX:

    CREATE MEMBER CURRENTCUBE.[Measures].[Net Lost Commitments]

    AS (iif([Date Dimension].[Fiscal Year Hierarchy].**MultipleMembersSelected**

    , null

    , [Measures].[Acquisitions] - [Measures].[Growth in Commitments]))

    Alternatively, rather than change the definition of this measure, is there a way in a SCOPE statement to say "this block appplies only when the context is a single member of the [Date Dimension]"?

    ADVthanksANCE,

    Matt.

  • A suggestion from another source has solved this for me. I can use --

    iif(iserror([Date Dimension].[Fiscal Year Hierarchy].CurrentMember),

    , null

    , [Measures].[Acquisitions] - [Measures].[Growth in Commitments]))

    CurrentMember will return an error when multiple members have been selected.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply