简体   繁体   English

获取总行 DAX Power BI 的正确总和

[英]Getting correct Sum for total row DAX Power BI

I have: Dim Table: Accounts: customer granularity level.我有:暗表:帐户:客户粒度级别。

Fact Table: PhoneCalls.事实表:电话。 calls to customers granularity level.呼叫客户粒度级别。

I need to create and see the number of calls made to a customer up until the customer made their first deposit.我需要创建并查看在客户进行首次存款之前向客户拨打的电话数量。

I was able to do this on the customer level but on the Total level I get a weird result:我能够在客户级别上做到这一点,但在总级别上我得到了一个奇怪的结果:

my measure:我的措施:

ACC_Calls_2_FDP = 
CALCULATE(
    COUNTROWS(PhoneCalls),
    PhoneCalls[disposition] = "ANSWERED", -- only calls that were answered
    PhoneCalls[calldate] <= MAX(Accounts[FDP_Date]), -- up until FDP date per customer
    USERELATIONSHIP(Accounts[AccountNo],PhoneCalls[AccountNo]) -- make the connection active
)

the results are:结果是:

在此处输入图像描述

On the total level i was expecting to see 14. not 536 what is going on?在总水平上,我期望看到 14。而不是536 ,这是怎么回事? what am i missing?我错过了什么?

The data model: Filter direction: Accounts filters PhoneCalls Cardinality 1:*数据模型:过滤方向:账户过滤电话呼叫基数1:*

Power BI doesn't sum up each of the row values as in Excel. Power BI 不会像在 Excel 中那样汇总每个行值。 Instead, for Grand total value they will still calculate it as a row itself with no filters on AccountNo on it.相反,对于总价值,他们仍然会将其计算为一行本身,而 AccountNo 上没有过滤器。

In this case, the max value of FDP_Date in the whole table is taken in the measure.在这种情况下,整个表中 FDP_Date 的最大值被用于度量。 So for example, ACC 1 has max date of 3, ACC 3 has the max of 10. The grand total calculation will use 10 as the max value and start countrows on whichever rows with FDP_Date < 10.例如,ACC 1 的最大日期为 3,ACC 3 的最大日期为 10。总计计算将使用 10 作为最大值,并在 FDP_Date < 10 的任何行上开始计数。

To fix this is tricky as I don't have any other information than this.解决这个问题很棘手,因为我没有除此之外的任何其他信息。 However, I hope this explains you well of the "bug".但是,我希望这可以很好地解释“错误”。

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

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