Sum(PeriodsToDate([Time_WeekTest].[Reporting Year - Reporting Month - Reporting Week - Reporting Day].[Reporting Year],ParallelPeriod( [Time_WeekTest].[Reporting Year - Reporting Month - Reporting Week - Reporting Day].[Reporting Year], 1, Tail( NonEmpty( Descendants( [Time_WeekTest].[Reporting Year - Reporting Month - Reporting Week - Reporting Day].CurrentMember, , Leaves ), [Measures].[SALES] ), 1 ).Item(0) )),[Measures].[SALES])
I am using the code inserted as a calculated member in my cube to get "Last Years Fiscal Year to date" $$.
I am having the following issue: I have a report putting this calc. on the columns and My "Account" & "product" dimensions on the rows. The issue is that not every account buys every product every day of the year. So, if account ABC has not bought product X since 7/1/2012, it computes last-YTD only through 7/1/2011. Whereas a customer buying every day (ie last SALE was yesterday) would have last-YTD ending 10/10/2011.
Therefore, I would like my previos YTD number to be based on the MAX Sale date (regardless of who & what was bought) -1 year. All accounts/products would use 10/10/2011 as their endpoint for last-YTD.
Sorry if this is confusing (realtively new to SSAS).
Thanks