我找到了此解决方案:
with calculated member [Measures].[Test1]
as
iif (isleaf([Time].[Calendar].currentmember)),
[Measures].[Measure1]/[Measures].[Measure2],
Sum([Time].[Calendar].currentmember.children, [Measures].[Test1]))
select Test1 on 0,
[Time].[Calendar]. members on 1
from
[MyCube]
它有效。
但是我想知道是否可以具有两个或更多个维度,并编写如下内容:
with calculated member [Measures].[Test1] as
iif (isleaf([Time].[Calendar].currentmember)) and isleaf([SecondDimension].[SecondDimensionHierarchy].currentmember),
[Measures].[Measure1]/[Measures].[Measure2],
**Sum([Time].[Calendar].currentmember.children, [Measures].[Test1])**)
select Test1 on 0,
[Time].[Calendar]. members on 1
from
[MyCube]
我尝试了此操作,但叶子得到了正确的结果,但是高级成员的值为空-我有两个层次结构时,我不知道如何写这个总和Sum([Time].[Calendar].currentmember.children, [Measures].[Test1])
。可能吗?
答案 0 :(得分:0)
我想我已经找到了解决方法:
with calculated member [Measures].[Test1] as
iif (isleaf([Time].[Calendar].currentmember)) and isleaf([SecondDimension].[SecondDimensionHierarchy].currentmember),
[Measures].[Measure1]/[Measures].[Measure2],
Sum((DESCENDANTS([Time].[Calendar].currentmember, , LEAVES) * DESCENDANTS([SecondDimension].[SecondDimensionHierarchy].currentmember, , LEAVES), [Measures].[Test1]))
select Test1 on 0,
[Time].[Calendar]. members on 1
from
[MyCube]