Quantcast
Channel: SQLServerCentral » Data Warehousing » Analysis Services » Latest topics
Viewing all articles
Browse latest Browse all 1341

MDX functions for rolling time periods

$
0
0
Hi All:I've looked on the web and found many examples of rolling time periods that suggest doing one of the two commands below. However, the measure always comes back as #error. I'm sure I'm just not seeing it... can anyone tell my why these two statements don't work? It's an attempt to sum the last 30 days from Feb 24th. Using a range (first command) and also using the LastPeriods functions both return #error.\\ Command with date rangeWITH MEMBER [Measures].[Gallons in Last 30 Days] AS Sum ( { [Start Date].[Calendar Hierarchy].[Date].Lag(29) : [Start Date].[Calendar Hierarchy].[Date].CurrentMember } ,[Measures].[Quantity In Gallons] ) SELECT { [Measures].[Quantity In Gallons] ,[Measures].[Gallons in Last 30 Days] } ON COLUMNS FROM [cube] WHERE [Start Date].[Calendar Hierarchy].[Date].&[20140224];\\Command with LastPeriods functionWITHMEMBER [Measures].[Gallons in Last 30 Days] AS sum(Lastperiods(29,[CIP Start Date].[Calendar Hierarchy].[Date].currentmember),[Measure].[Quantity In Gallons]) SELECT { [Measures].[Quantity In Gallons] ,[Measures].[Gallons in Last 30 Days] } ON COLUMNS FROM [vEMI_CIP] WHERE [CIP Start Date].[Calendar Hierarchy].[Date].&[20140224];Cheers and thanks,Simon

Viewing all articles
Browse latest Browse all 1341

Trending Articles