SSAS计算的度量未与其过滤后的维度相切

问题描述

我创建了这样的度量,问题是它没有按照自己的尺寸进行切片。是这样期望还是我错过了一些东西。我是MDX脚本的新手,我们将不胜感激。

CREATE MEMBER CURRENTCUBE.[Measures].[CHARGE_CODE_TEST]
 AS Aggregate([Charege].[Station].&[CA2],[Measures].[Inv Line Amt]),VISIBLE = 1  ; 

enter image description here

CREATE MEMBER CURRENTCUBE.[Measures].[CHARGE_CODE_TEST]
     AS Aggregate({[Charege].[Station].&[CA1],[Charege].[Station].&[CA2]},VISIBLE = 1  ; 

enter image description here

解决方法

它应该像这样工作-以您编写它的方式工作-不管您要针对[Charege].[Station]层次结构的哪个成员[CHARGE_CODE_TEST]进行度量,它将始终汇总[Inv Line Amt]第一种情况为[Charege].[Station].&[CA2],第二种情况为CA1和CA2。如果从“聚合”函数中删除这些成员,则它将在当前单元格的上下文中显示数字,就像[Measures].[Inv Line Amt]一样。

在第一种情况下尝试使用类似的方法

CREATE MEMBER CURRENTCUBE.[Measures].[CHARGE_CODE_TEST]
 AS IIf([Charege].[Station].CurrentMember IS [Charege].[Station].&[CA2],([Charege].[Station].&[CA2],[Measures].[Inv Line Amt]),0),VISIBLE = 1  ; 

如果我理解正确,那应该是第二种情况:

    CREATE MEMBER CURRENTCUBE.[Measures].[CHARGE_CODE_TEST]
     AS IIf([Charege].[Station].CurrentMember IS [Charege].[Station].&[CA2]
OR [Charege].[Station].CurrentMember IS [Charege].[Station].&[CA1],({[Charege].[Station].&[CA1],[Charege].[Station].&[CA2]},VISIBLE = 1  ; 

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...