Home Forums Data Warehousing Analysis Services Different aggreation results with and without a dummy WITH clause RE: Different aggreation results with and without a dummy WITH clause

  • Like you, I thought of putting fake values back into the cube's Calculation script rather than using WITH. I wanted to figure out whether null came from:

    1. No calculation being performed at all

    2. The THEN part of the IIF statement

    3. Something going wrong in the subtraction within the ELSE part of the IIF statement.

    So I tried this:

    CREATE MEMBER CURRENTCUBE.[Measures].[Net Lost Commitments (during period)]

    -- AS null

    AS 9990

    , FORMAT_STRING = '#,#'

    , ASSOCIATED_MEASURE_GROUP = 'Commitment Measures'

    , DISPLAY_FOLDER = 'Time-based Commitment Measures'

    , VISIBLE = true;

    SCOPE (DESCENDANTS([Date Dimension].[Fiscal Year Hierarchy],,AFTER));

    -- [Net Lost Commitments] can only be calculated if [Growth in Commitments] can be,

    -- and that is only possible if just one member is selected from the date dim.

    -- So if referring to [Date Dim].currentMember fails (probably coz multiple members have been selected) then return null.

    [Measures].[Net Lost Commitments (during period)] =

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

    --, null

    --, [Measures].[Acquisitions (during period)] - [Measures].[Growth in Commitments (during period)]);

    , 9991

    , 9992);

    END SCOPE;

    SCOPE (DESCENDANTS([Date Dimension].[Calendar Year Hierarchy],,AFTER));

    [Measures].[Net Lost Commitments (during period)] =

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

    --, null

    --, [Measures].[Acquisitions (during period)] - [Measures].[Growth in Commitments (during period)]);

    , 9993

    , 9994);

    END SCOPE;

    ... and then ran this query ...

    select

    {[Measures].[Net Lost Commitments (during period)]

    ,[Measures].[Net Lost Commitments (during previous period)]

    } on columns

    , {[Date Dimension].[Fiscal Year Hierarchy].[Fiscal Month].AllMembers} on rows

    from Compass3

    The results were [Net Lost Commitments (during period)] = 9992 for all periods (that's what I expect) -- *except* [Dec-2010] in which case the value shown is 9990.

    Comment 1: Every time I rebuild, the null values seem to move around. In this case, the anomaly does not show up at the Year level but at the Month level.

    Comment 2: I have just checked (again!) the order of measure definitions. Every measure in the calculation script is defined later in the script than any measure on which it depends.

    Comment 3: The value 9990 implies that no calculation is being performed: that value is specified *outside* the SCOPE statements. So why would this one member of the date dimension not be covered by the SCOPE?