MDX脚本 - 将尺寸与参数混合

时间:2016-12-09 08:46:17

标签: ssas mdx olap dimensions

早上好 我正在研究一个具有两个日期维度的立方体,具有相同的结构。 预订日期是我每天加载大约1000条记录的日期 修复管理员允许日期是另一个日期,它在日常记录中是不同的。

样本可以在这里找到:

|的预订__ |的修复______ |的 sheet_measure |
| ------------------------------------------------- --- |
| 20161207,| 20161104,| 100个
| 20161207,| 20161109,| 150个
| 20161207,| 20161209,| 250个
| 20161208,| 20160801,| 80,
| 20161208,| 20161110,| 150,
| 20161208,| 20161208,| 250,
| 20161209,| 20161008,| 2,
| 20161209,| 20161210,| 1,
| 20161209,| 20161211,| 20,

我想仅查询该数据集,其中修复管理员允许的日期小于或等于预订日期。 (在示例中:仅显示:20161207 => 20161104,20161208 => 20160801,20161110,20161208和20161209 => 20161008)

我正在使用此mdx查询:

SELECT  NON EMPTY { [Measures].[Sheet Missing] } ON COLUMNS,{[Booking Date].[Date].[Date].ALLMEMBERS} * {LastPeriods(2,StrToMember("[Booking Date].[Calendar Week].&[2016 KW 49]" ) )  } } ON ROWS FROM [ProductionCube] where ([Date - Fix Admin Allowed Date].[Calendar].[Date].&[20140101] : STRTOMEMBER('[Date - Fix Admin Allowed Date].[Calendar].[Date].&['+Format(Now(),'yyyyMMdd')+']') )

我尝试使用currentmember.properties(“Key”),如下所示:

   STRTOMEMBER('[Date - Fix Admin Allowed Date].[Calendar].[Date].&['+ [Booking Date].[Date].currentmember.properties("Key") +']') )

它包含parralel periode,因为我会在报告中看到最近2周。

你怎么看?这真的很复杂吗? 我的想法已经不多了..

感谢您的阅读

1 个答案:

答案 0 :(得分:0)

我只是想知道你是否可以使用datediff创建一个计算成员来生成数字输出,然后对其进行过滤?

with
member [Measures].[Fix Admin is less than Booking Date] as
datediff("d", <booking date member expression>, <fix date member expression>)
<body of select statement... include filter statement against [Measures].[Fix Admin is less than Booking Date]>

道歉,我无法提供完整的解决方案......但请告诉我这是否有帮助。

相关问题