Answered by:
How to Create Previous Month MDX measures

Question
-
I have Date dimension with following hierarchy
Year>Quarters>Month>Date
I have measure IDCOUNT in a fact table on daily basis.
Now I want to create following MDX measures.
Previous Month IDCount
Previous Month IDCount-1 -- means 1 month from previous Lag(1) on monthly basis
If a user select month [Jan 2015] then MDX measures should be
Previous Month IDCount -- [Feb 2015]
Previous Month IDCount-1 -- [Dec 2014]Monday, March 16, 2015 3:05 PM
Answers
-
Hi ,
You can use below link;
https://austinslik.wordpress.com/2009/07/22/mdx/
https://ask.sqlservercentral.com/questions/89580/mdx-query-to-return-last-six-months-for-current-ye.html
Try with below time function available in MDX
- Period to Date
- Parallel period
- Currentmember.lag
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com
- Edited by BI_Support Monday, March 16, 2015 6:36 PM
- Proposed as answer by Simon_HouMicrosoft contingent staff Thursday, March 19, 2015 2:20 AM
- Marked as answer by Simon_HouMicrosoft contingent staff Tuesday, March 24, 2015 2:29 AM
Monday, March 16, 2015 6:34 PM -
In simple terms, it's just a matter of creating a calculated measure such as
[DateDimension].[YQMD Hierarchy].prevmember
This assumes that your query is focussed on a month. This calc will always get the previous period from whatever is selected. If you were focussed on a day, it would show the previous day etc. You could put in a CASE statement to check the level, or an Ancestor() statement to go back one month even though the user has a day selected etc. It all depends on what you want.
Hope that helps
Richard
- Proposed as answer by Simon_HouMicrosoft contingent staff Thursday, March 19, 2015 2:30 AM
- Marked as answer by Simon_HouMicrosoft contingent staff Tuesday, March 24, 2015 2:29 AM
Tuesday, March 17, 2015 12:27 AM
All replies
-
Hi ,
You can use below link;
https://austinslik.wordpress.com/2009/07/22/mdx/
https://ask.sqlservercentral.com/questions/89580/mdx-query-to-return-last-six-months-for-current-ye.html
Try with below time function available in MDX
- Period to Date
- Parallel period
- Currentmember.lag
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com
- Edited by BI_Support Monday, March 16, 2015 6:36 PM
- Proposed as answer by Simon_HouMicrosoft contingent staff Thursday, March 19, 2015 2:20 AM
- Marked as answer by Simon_HouMicrosoft contingent staff Tuesday, March 24, 2015 2:29 AM
Monday, March 16, 2015 6:34 PM -
In simple terms, it's just a matter of creating a calculated measure such as
[DateDimension].[YQMD Hierarchy].prevmember
This assumes that your query is focussed on a month. This calc will always get the previous period from whatever is selected. If you were focussed on a day, it would show the previous day etc. You could put in a CASE statement to check the level, or an Ancestor() statement to go back one month even though the user has a day selected etc. It all depends on what you want.
Hope that helps
Richard
- Proposed as answer by Simon_HouMicrosoft contingent staff Thursday, March 19, 2015 2:30 AM
- Marked as answer by Simon_HouMicrosoft contingent staff Tuesday, March 24, 2015 2:29 AM
Tuesday, March 17, 2015 12:27 AM