MDX计算会员问题

时间:2013-10-15 10:42:03

标签: 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 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  ; 

1 个答案:

答案 0 :(得分:1)

问题是你如何比较Dimension值。

当你说

  

[Dim Trans Type Code]。[Trans Type Code] ='10'

真正比较

  

[Dim Trans Type Code]。[Trans Type Code]。[All]   到'10'。

你需要像这样编写你的比较:

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

该示例是精简的,但您可以看到每个维度的更改。这还要求每个维度层次结构都位于查询中的某个位置。如果没有,那么它就是它的全部版本,你的IIF将不会评估你创建的成员。

相关问题