Sql server 2008 MDX计算成员问题

Sql server 2008 MDX计算成员问题,sql-server-2008,mdx,ssas-2008,Sql Server 2008,Mdx,Ssas 2008,我试图在某些条件下计算一个新的度量,我首先创建了一个第一级成员,然后尝试在下一个成员定义中使用它 下一个成员“CashDisp”在If条件下评估为零,我是SSAS的新手,请帮助我解决此问题 /* The CALCULATE command controls the aggregation of leaf cells in the cube. If the CALCULATE command is deleted or modified, the data within the cube is a

我试图在某些条件下计算一个新的度量,我首先创建了一个第一级成员,然后尝试在下一个成员定义中使用它

下一个成员“CashDisp”在If条件下评估为零,我是SSAS的新手,请帮助我解决此问题

/*
The CALCULATE command controls the aggregation of leaf cells in the cube.
If the CALCULATE command is deleted or modified, the data within the cube is affected.
You should edit this command only if you manually specify how the cube is aggregated.
*/
CALCULATE;    
CREATE MEMBER CURRENTCUBE.[Measures].CashDispensed
 AS [Measures].[Orig Trans Amount]/100, 
VISIBLE = 1;     
CREATE MEMBER CURRENTCUBE.[Measures].CashDisp
 AS IIF([Dim Trans Type Code].[Trans Type Code] ='10'
and [Dim Termn Ln].[Termn Ln]= 'PRO1'
and [Dim Reversal Reason].[Reversal Reason] ='00'
and [Dim Trans Response Code].[Trans Response Code] ='051',[Measures].CashDispensed,0), 
VISIBLE = 1  ; 

问题在于如何比较标注值

当你说

[Dim传输类型代码].[Trans类型代码]='10'

这真是一种比较

[Dim传输类型代码].[传输类型代码].[全部] 到'10'

您需要这样写比较:

IIF([Dim Trans Type Code].[Trans Type Code].currentmember IS [Dim Trans Type Code].[Trans Type Code].&[10],[Measures].CashDispensed,0)

该示例已压缩,但您可以看到每个维度的变化。这还要求每个维度层次结构都位于查询中的某个位置。如果不是,则它是它的所有版本,您的IIF将不会对您创建的成员求值。

多维数据集会话或查询需要该成员吗?尝试使用
[Measures].[Orig Trans Amount]/100
作为第二个成员创建语句的最后一部分。我在多维数据集会话中需要它,尝试使用[Measures].[Orig Trans Amount]/100它仍然返回零,因此考虑创建一个继承信息的新成员。我刚刚注意到,当我拖动[Measures]时,多维数据集浏览器中有数据。[Orig Trans Amount]在此列上是总和,但只要我拖动计算出的成员“cashdisp”[Measures]。[Orig Trans Amount]变为空白,并且casdisp的值为零..不确定它是否在relationshipsthanks上绊倒..此解决方案有效..我有几个问题[Dim Trans Type Code].[Trans Type Code].[All]“10”的实际含义是什么?另外,如果我想使用多个比较值,请尝试以下语法:[Dim Trans Response Code].[Trans Response Code]。currentmember是([Dim Trans Response Code].[Trans Response Code].[051],[Dim Trans Response Code].[052]),我应该说它与[Dim Trans Type Code]相同[Trans Type Code].[All]='10'。执行多个值是一个很大的骗局。你应该为此提出另一个问题。