简体   繁体   English

SSAS计算得出的度量,仅显示特定尺寸值的值

[英]SSAS Calculated measure to show values only for specific dimension values

I have a calculated Measure in my SSAS cube, which I want to calculate only for a group of dimension members and for rest it should be zero. 我在SSAS多维数据集中有一个计算得出的度量,我只想为一组维成员进行计算,其余的应该为零。 In The following image I want MTDOccupancy dimension to work only for Account Groups for Rooms, rest related to food should show zero for this field. 在下图中,我希望MTDOccupancy维度仅适用于“房间”帐户组,与食物相关的其余部分应在此字段中显示为零。 在此处输入图片说明

following is the simple MDX which I am using for MTDOccupancy measure 以下是我用于MTDO占用率测量的简单MDX

([MTDQuantity]/[MTDAvailableRooms])*100

You can change the measure to something like the following: 您可以将度量更改为以下内容:

IIF(
    LEFT([Account Group].[Account Group].currentmember.member_caption,5) = "ROOMS"
  ,([MTDQuantity]/[MTDAvailableRooms])*100
  ,NULL
)

I have guessed this dimension/hierarchy combination [Account Group].[Account Group]. ... 我猜想此维度/层次结构组合为[Account Group].[Account Group]. ... [Account Group].[Account Group]. ... - you will need to change this to reflect the names used in your cube. [Account Group].[Account Group]. ...您将需要更改它以反映多维数据集中使用的名称。

Please do it as a scope statement for performance reasons. 出于性能方面的原因,请作为范围声明使用。 The following will get evaluated the first time someone connects to the cube vs the LEFT running in every cell at report time: 在报表时间第一次有人连接到多维数据集与在每个单元格中运行的LEFT时,将评估以下内容:

Create member CurrentCube.[Measures].[My Calc] 
as null
,format_string="0.0%";

scope(Filter([Account Group].[Account Group].[Account Group].Members,   LEFT([Account Group].[Account Group].currentmember.member_caption,5)="ROOMS")); 
   [Measures].[My Calc] = iif(MTDAvailableRooms=0,null,([MTDQuantity]/[MTDAvailableRooms])); 
end scope;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM