MDX Get last non empty value for EACH month

  • I need to get the last non empty value of Total Cost for EACH month.

    M,P,R are parcel types, B is also a parcel type which i don't want to see.

    I tried all kinds of codes, here is what i have now:

    SELECT { [Measures].[Total Cost Price] } ON COLUMNS,

    NON EMPTY {TAIL(NonEmptyCrossJoin([TimeDim].[Date].AllMembers,1),1) *

    [Parcel Type].[Parcel Type ID].[Parcel Type ID].ALLMEMBERS ) } ON ROWS

    FROM ( SELECT (-{ [Parcel Type].[Parcel Type ID].& } ) ON COLUMNS

    FROM [SomeDB])

    It gives the following result:

    September 2013M2,307,538

    September 2013P39,242,845

    September 2013R38,412,620

    Which is exactly what i need for September, 22/9/2013 is the last date in September which holds data and the value is correct for each parcel type.

    But i need this for each month, August etc.

    Can anyone please suggest a solution? I use sql 2008

Viewing 0 posts

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