Skip to content

Instantly share code, notes, and snippets.

@osya
Created January 25, 2015 15:34
Show Gist options
  • Save osya/88d0d95812dbaa2bd717 to your computer and use it in GitHub Desktop.
Save osya/88d0d95812dbaa2bd717 to your computer and use it in GitHub Desktop.
Calculating SMA in MDX #MDX
WITH MEMBER [Measures].[SMA 30] AS Avg( LastPeriods( 30, [Date].[Date].CurrentMember ), [Measures].[Internet Order Count] )
SELECT { [Measures].[Internet Order Count], [Measures].[SMA 30] } ON 0,
{ [Date].[Date].[Date].MEMBERS } ON 1
FROM [Adventure Works]
WHERE ( [Date].[Calendar Year].&[2008] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment