开发者

Getting data for past 6 months in MDX

开发者 https://www.devze.com 2023-03-01 16:51 出处:网络
I am using SSRS to create reports. For the metrics i am pulling out data from the analysis services. I want to modify the mdx query created by the query designer to include data only from past 6 month

I am using SSRS to create reports. For the metrics i am pulling out data from the analysis services. I want to modify the mdx query created by the query designer to include data only from past 6 months. The query开发者_StackOverflow社区 looks like this right now:

SELECT NON EMPTY { [Measures].[Cumulative Count] } ON COLUMNS, 
        NON EMPTY { ([Work Item].[Microsoft_VSTS_Common_Discipline].[Microsoft_VSTS_Common_Discipline].ALLMEMBERS * [Date].[Year Month Date].[Month].ALLMEMBERS ) } 
        DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS 
        FROM 
          ( SELECT ( { [Work Item].[System_WorkItemType].&[Task] } ) ON COLUMNS 
        FROM 
          ( SELECT ( { [Date].[Year Month Date].[Year].&[2010-01-01T00:00:00] } ) ON COLUMNS FROM [Team System])) 
       WHERE ( [Work Item].[System_WorkItemType].&[Task] ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS*

Here I am pulling out the cumulative count of the work items where the work item type is task and the year of the work item is 2010. However instead of pulling out all the months from 2010 i want past 6 months. Does anyone know how can i do this in the above query.


Create a new calculated member that returns data for only the last 6 months.


I have done this in the past by adding VBA functions to my MDX (Analysis Services allows this). You can get the current date, work back 6 months, grab the month/year, and write a string in the same format as your member names. Then use StrToSet to include this string in your MDX query.

0

精彩评论

暂无评论...
验证码 换一张
取 消