Monday, 30 September 2013

MDX Get last non empty value for EACH month

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].&[B] } ) ON COLUMNS
FROM [SomeDB])
It gives the following result:

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. But i need this for
each month, August etc.
Can anyone please suggest a solution? I use sql 2008

No comments:

Post a Comment