I'm trying to create a measure that holds the prior period value
Normally what you do is:
WITH Member Measures.PrevAmt AS ([Time].[Calendar].CurrentMember.Lag(1),Measures.Amount)
SELECT {Measures.Amount,MEasures.PRevAmt} on 0
,{[Time].[Calendar].[year]
,[Time].[Calendar].[quarter]
,[Time].[Calendar].[Month]} on 1
from [sales]
works fine, but i only want to limit it to a particular year. Easy, add Where ([Time].[Year].[2008])
but the resultset returns null for prevamt where the .lagged member would be in 2007 (eg at the year level and and the 1st member of each subsequent level). SSAS MDX returns the expected result and there's nothing in the IcCube doco that says that .lag/parallelperiod etc functions execute after the slicer is applied and the final resultset is created...
I get the expected results if i hack something together like this
WITH Member Measures.PrevAmt AS ([Time].[Calendar].CurrentMember.Lag(1),Measures.Amount)
SELECT {Measures.Amount,MEasures.PRevAmt} on 0
,{[Time].[Calendar].[2008]
,descendants([Time].[Calendar].[2008],1)
,descendants([Time].[Calendar].[2008],2)} on 1
from [sales]
but this breaks when we slice by an attribute that isn't in the select list (and this code is ugly and probably slower)
Am i missing something?