简体   繁体   English

SSAS计算得出的成员-如何根据另一项指标计算总数的百分比

[英]SSAS Calculated Member - how to do percent of total based on another measure

I am currently trying to create a calculated measure for an SSAS 2008 R2 cube. 我当前正在尝试为SSAS 2008 R2多维数据集创建计算的度量。 In a financial cube dealing with accounts receivable data, I have a "Gross Balance" measure, and a "Days Since DOS" measure. 在处理应收帐款数据的财务多维数据集中,我有一个“总余额”量度和一个“从DOS开始的天数”量度。 The "Days Since DOS" measure is invisible to the user because it is only used in combination with a couple others to gain an average. 用户看不到“自DOS以来的天数”度量,因为它仅与其他几个结合使用以获取平均值。

I would like the new calculated measure to show the percent of the total gross balance that has a Days Since DOS value > 90. 我希望新的计算得出的度量能够显示DOS以来天数> 90的总余额的百分比。

For example, if the total gross balance were $1000, the total gross balance for records with days since DOS > 90 being $500, the Percent Over 90 Days calculated measure would show 50%. 例如,如果总余额为1000美元,则自DOS> 90开始具有天数的记录的总余额为500美元,则“ 90天百分比”计算得出的度量将显示50%。

Would it be possible to do this with my current setup, and if so, how would I go about writing the expression? 使用当前的设置是否可以做到这一点,如果可以,我将如何编写表达式?

I found out that it is in fact possible. 我发现实际上是可能的。

First, create a new named calculation in the DSV using a case statement (for example, call it [Gross Bal Over 90]): 首先,使用case语句(例如,将其命名为[Gross Bal Over 90])在DSV中创建一个新的命名计算:

CASE 
    WHEN [Days Since DOS] > 90 THEN [Gross Balance]
    ELSE 0
END

Then, the calculated measure would simply be: 然后,计算得出的度量将仅仅是:

Sum([Gross Bal Over 90])/Sum([Gross Balance])

You can then make [Gross Bal Over 90] invisible to the user, keeping a cleaner look. 然后,您可以使用户看不到[Gross Bal Over 90],从而使外观保持整洁。

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

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