MDX Queries - Compare Current Month with data from 2 months before
Problem: Creating SSRS report from Cube, I need to write MDX query to compare current month with previous 2 months figures
Solution used as below:
/* Using Lag function to calculate
before 2 Months */
WITH MEMBER [Measures].[Previous
2 Months] AS
([Date].[Calendar Date].Lag(2),
[Measures].[Total Sales Amount]), Format_String
= "Currency"
SELECT
{ [Measures].[Total Sales Amount],
[Measures].[Previous 2 Months]} on columns,
non empty [Date].[Calendar
Date].[Month Name].Members on rows
FROM [Analysis Services Tutorial]
Comments
Post a Comment