There was a requirement to show only the last month value for a particular measure, for the given period.
If the period is 2016, then it show the measure value of the 2016 Dec.
If the period is 2016 Q3, then the measure value has to be 2016 Sep.
I was able to achieve it, by creating a calculated measure using ClosingPeriod function.
Formula of the Calculated Measure is as below
(ClosingPeriod([DimDate].[Year-Quarter-Month].[Month], [DimDate].[Year-Quarter-Month].CurrentMember),[Measures].[Count])
You can test it using the below MDX Query as well.
WITH MEMBER [Measures].[LastMonthValue]
AS (ClosingPeriod([DimDate].[Year-Quarter-Month].[Month], [DimDate].[Year-Quarter-Month].CurrentMember),[Measures].[Count])
SELECT NON EMPTY { [Measures].[LastMonthValue] } ON COLUMNS
FROM [CubeName]
WHERE STRTOSET(@Period,CONSTRAINED)
Hope this will be helpful...
If the period is 2016, then it show the measure value of the 2016 Dec.
If the period is 2016 Q3, then the measure value has to be 2016 Sep.
I was able to achieve it, by creating a calculated measure using ClosingPeriod function.
Formula of the Calculated Measure is as below
(ClosingPeriod([DimDate].[Year-Quarter-Month].[Month], [DimDate].[Year-Quarter-Month].CurrentMember),[Measures].[Count])
You can test it using the below MDX Query as well.
WITH MEMBER [Measures].[LastMonthValue]
AS (ClosingPeriod([DimDate].[Year-Quarter-Month].[Month], [DimDate].[Year-Quarter-Month].CurrentMember),[Measures].[Count])
SELECT NON EMPTY { [Measures].[LastMonthValue] } ON COLUMNS
FROM [CubeName]
WHERE STRTOSET(@Period,CONSTRAINED)
Hope this will be helpful...
No comments:
Post a Comment