本文介绍了将相同层次结构中的两个元组合并为一个(在MDX WITH SET命令中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下MDX查询返回三个元组上的度量X:2001、2002-1和2002-2.我正在尝试将2002-1和2002-2合并为一个元组,并具有2001和2002-1& 2的度量X.不能使用SUM功能.因为度量X用于其他轴.

The following MDX query returns measure X on 3 tuples: 2001, 2002-1 and 2002-2. What I am trying to do is merging 2002-1 and 2002-2 into one tuple and have the measure X for 2001 and 2002-1&2. Using SUM function is not possible. Because measure X is used on other axis.

with 
member v as [Measures].[X]
set w as {[Dim Date].[Calendar Date].[Year].&[2001],
[Dim Date].[Calendar Date].[Month].&[1]&[2002],
[Dim Date].[Calendar Date].[Month].&[2]&[2002]}
select w on 0, v on 1
from [DS];

推荐答案

您可以在[日期]添加计算的成员:

You can add calculated members in [Dim Date]:

with 
member [Dim Date].[Calendar Date].[2002 All] as [Dim Date].[Calendar Date].[Month].&[1]&[2002] + [Dim Date].[Calendar Date].[Month].&[2]&[2002]
...

如果您喜欢此语法,则可以使用聚合或求和函数.

You can use aggregate or sum functions if your prefer this syntax.

这篇关于将相同层次结构中的两个元组合并为一个(在MDX WITH SET命令中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:15