MDX to Create Named Set to Get Months of Current and Previous Years
WITH
SET [Previous Year Months]
AS (StrToMember('[MonthlyPeriod].[Calendar
Month].[Year].&['+ CSTR(CINT(FORMAT(NOW(), "yyyy"))-1) +
'].&[1]'):StrToMember('[MonthlyPeriod].[Calendar Month].[Year].&['+
CSTR(CINT(FORMAT(NOW(), "yyyy"))-1) + '].&[12]'))
SET [Current Year Months]
AS (StrToMember('[MonthlyPeriod].[Calendar
Month].[Year].&['+ FORMAT(NOW(), "yyyy") +
'].&[1]'):StrToMember('[MonthlyPeriod].[Calendar Month].[Year].&['+
FORMAT(NOW(), "yyyy") + '].&[12]'))
SELECT [Previous Year Months] ON COLUMNS
FROM [CUBE]
No comments:
Post a Comment