1

我正在处理来自 TFS2010 Cube 的 MDX 数据集(我还在 Team Foundation Server - Reporting & Warehouse 论坛上发帖)。

我希望在过去几个月中产生老化缺陷的趋势。我有代码生成我需要的数据,因为我无法让它以我需要的 SSRS 折线图的方式计算。这是代码:

WITH MEMBER [Measures].[AgedGroupTotal] AS ([Measures].[Work Item Count])
MEMBER [Measures].[AgedGroup30] AS IIF(DATEDIFF("d", [Work Item].[System_CreatedDate].CurrentMember.Name, [Date].[Date].CurrentMember.Name) <= 30, [Measures].[Work Item Count], null)
MEMBER [Measures].[AgedGroup3060] AS IIF(DATEDIFF("d", [Work Item].[System_CreatedDate].CurrentMember.Name, [Date].[Date].CurrentMember.Name) > 30 AND DATEDIFF("d", [Work Item].[System_CreatedDate].CurrentMember.Name, [Date].[Date].CurrentMember.Name) <= 60, [Measures].[Work Item Count], null)
MEMBER [Measures].[AgedGroup6090] AS IIF(DATEDIFF("d", [Work Item].[System_CreatedDate].CurrentMember.Name, [Date].[Date].CurrentMember.Name) > 60 AND DATEDIFF("d", [Work Item].[System_CreatedDate].CurrentMember.Name, [Date].[Date].CurrentMember.Name) <= 90, [Measures].[Work Item Count], null)
MEMBER [Measures].[AgedGroup90] AS  IIF(DATEDIFF("d", [Work Item].[System_CreatedDate].CurrentMember.Name, [Date].[Date].CurrentMember.Name) > 90, [Measures].[Work Item Count], null)
SELECT NON EMPTY { [Measures].[AgedGroup30], [Measures].[AgedGroup90], [Measures].[AgedGroup6090], [Measures].[AgedGroup3060], [Measures].[AgedGroupTotal] }
ON COLUMNS, NON EMPTY { ([Date].[Month].[Month].ALLMEMBERS *
[Date].[Week].[Week].ALLMEMBERS *
[Date].[Date].[Date].ALLMEMBERS *
[Work Item].[System_CreatedDate].[System_CreatedDate].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME
ON ROWS FROM ( SELECT ( [Date].[Date].&[2013-01-01T00:00:00] : [Date].[Date].&[2013-03-31T00:00:00] )
ON COLUMNS FROM ( SELECT ( { [Work Item].[System_State].&[Active] } )
ON COLUMNS FROM ( SELECT ( { [Work Item].[System_WorkItemType].&[Bug] } )
ON COLUMNS FROM [Work Item])))
WHERE ([Work Item].[System_WorkItemType].&[Bug], [Work Item].[System_State].&[Active])

结果如下:图片:http: //social.msdn.microsoft.com/Forums/getfile/258636

月 周 日期 创建日期 AgedGroup30 AgedGroup90 AgedGroup6090 AgedGroup3060 AgedGroupTotal 2013 年 1 月 05 日结束的一周 2013 年 1 月 1 日 2012 年 3 月 15 日(空) 2(空)(空) 2013 年 1 月 2 日 2013 年 1 月 1 日结束的一周2012 年 3 月 21 日(空) 3 (空)(空) 2013 年 1 月 3 日截至 1 月 5 日的一周 2013 年 1 月 1 日 2012 年 3 月 29 日(空) 1 (空)(空) 2013 年 1 月 1 日 1 月结束的一周05 2013 年 1 月 1 日 2012 年 3 月 30 日 (null) 0 (null) (null) 0 2013 年 1 月结束的一周 05 1/1/2013 4/3/2012 (null) 1 (null) (null) 1 2013 年 1 月截至 1 月 05 日的一周 2013 年 1 月 1 日 2012 年 4 月 5 日(空) 5 (空)(空) 2013 年 1 月 5 日 2013 年 1 月 5 日结束的周 2013 年 1 月 1 日 2012 年 4 月 6 日(空) 10 ( null) (null) 1 月 10 日,2013 年 1 月 5 日结束的一周 2013 年 1 月 1 日 2012 年 4 月 12 日(空) 0(空)(空) 0 2013 年 1 月 05 日结束的周 2013 年 1 月 1 日 2012 年 4 月 14 日(空) 2(空) (空) 2

问题是 [Work Item].[System_CreatedDate].[System_CreatedDate].ALLMEMBERS 需要包含在结果中。如果不包含此成员,则年龄组的 DATEDIFF 公式不会计算并给出 #Error。如果我将此数据输出到带有 AgedGroups 上的 SUM 的 SSRS 表中,并排除创建日期,我将获得所需的数据集:

图片:http : //social.msdn.microsoft.com/Forums/getfile/258639

月 周 日期 Aged Group30 Aged Group3060 Aged Group6090 Aged Group90 AgedGroupTotal 2013 年 2 月结束的一周 2013 年 2 月 1 日 20 1 2 2 25 2013 年 2 月 2 日 20 1 2 2 25 2013 年 2 月 3 日结束的一周 20 1 2 2 25 2013 年 2 月 4 日 28 0 3 2 33 2013 年 2 月 5 日 37 0 3 2 42 2013 年 2 月 6 日 50 1 3 1 55 2013 年 2 月 7 日 60 1 7 3 71 2013 年 2 月 8 日 58 2 7 3 70 2013 年 2 月 9 日 58 2 7 3 70

问题是我的 MDX 数据集中需要这个总和结果。但是,我不能排除创建问题的创建日期。我是 MDX 的新手,但在 SQL 中,使用 TEMP 表和 sum/group by 会很简单。但是,我知道 MDX 不是这样工作的。谁能帮我弄清楚如何在 MDX 中获取此数据集?

感谢您的任何帮助,

Evgapro

4

0 回答 0