通过使用MDX on multiple hierarchical dimensions的答案,我有以下MDX查询:
with
member L1Y1 as ([Dim Location].[Hierarchy].[Center].&[1],
[Dim Date].[Calendar Date].[Year].&[2010],
[Measures].[x])
select ([Dim Attribute].[Parent Code].&[10000]) on 0,
({L1Y1}) on 1
from DS
现在的问题是如何根据子进程过滤L1Y1。例如,假设我们想要过滤它,以便查询中只包含第2季和第7季。以下查询输出与上述相同,where
子句无效:
with
member L1Y1 as ([Dim Location].[Hierarchy].[Center].&[1],
[Dim Date].[Calendar Date].[Year].&[2010],
[Measures].[x])
select ([Dim Attribute].[Parent Code].&[10000]) on 0,
({L1Y1}) on 1
from DS
where [Dim Date].[Calendar Date].[Season].&[2] and
[Dim Date].[Calendar Date].[Month].&[7]
答案 0 :(得分:2)
除非您删除了属性,否则您的时间维度中应该有多个层次结构。你能试试这个:
with
member L1Y1 as ([Dim Location].[Hierarchy].[Center].&[1],
[Dim Date].[Calendar Date].[Year].&[2010],
[Measures].[x])
select ([Dim Attribute].[Parent Code].&[10000]) on 0,
({L1Y1}) on 1
from DS
where [Dim Date].[Season].&[2] and [Dim Date].[Month].&[7]
注意,因为我们不使用层次结构[日历日期]时间成员不会被覆盖但是被过滤。
答案 1 :(得分:1)
怎么样:
with
member L1Y1 as ([Dim Location].[Hierarchy].[Center].&[1],
[Dim Date].[Calendar Date].[Year].&[2010],
[Measures].[x])
member S2 as ([Dim Location].[Hierarchy].[Center].&[1],
[Dim Date].[Calendar Date].[Season].&[2],
[Measures].[x])
member M7 as ([Dim Location].[Hierarchy].[Center].&[1],
[Dim Date].[Calendar Date].[Month].&[7],
[Measures].[x])
select ([Dim Attribute].[Parent Code].&[10000]) on 0,
(L1Y1, S2, M7) on 1
from DS
我知道这是一种比较费力的方法,但你会得到结果。如果您只想获得单个值,则可以尝试仅保留M7度量。