Power BI唯一计数不正确总计

编程入门 行业动态 更新时间:2024-10-10 11:26:21
本文介绍了Power BI唯一计数不正确总计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正尝试使用DAX作为来计算表A 中客户 的非重复计数

I am trying to calculate Distinct Count of 'Cust' in Table A using DAX as

CALCULATE(DISTINCTCOUNT('TableA'[Cust]))

我正确地获得了不同的计数,但总数不正确。

Where I'm getting the distinct count correctly but the Total is Incorrect.

任何有关更正公式的建议都将有所帮助。谢谢!!

Any suggestions on correcting the formula would be helpful. Thanks!!

推荐答案

假设您有四个客户 Alex, John, Mike , Joe 分成三个 BT 个组,分别为 AUT,CT,MT 。

Let's say you have four customers "Alex","John","Mike","Joe" in three BT groups AUT,CT,MT.

AUT 具有 Alex, John, Mike

CT 有约翰,乔

MT 具有 Alex, John, Mike, Joe

您的表将是

BT Count ---------- AUT 3 CT 2 MT 4

现在,由于您只有四个客户,我希望您的总数是 4 ,而不是 3 + 2 + 4 = 9 。在后者中,您已经将 Alex , Joe 和 Mike 和三重计数的 John 。

Now since you have only four total customers, I would expect your total to be 4, not 3 + 2 + 4 = 9. In the latter, you've double counted Alex, Joe, and Mike and triple counted John.

如果您确实希望您的总数是小计(尽管我不明白为什么在这种情况下会如此),您可以执行以下操作:

If you really do want your total to be the sum of the subtotals (though I don't see why you would want this in this case), you can do the following:

AddSubtotals = SUMX(VALUES('TableA'[BT]), CALCULATE(DISTINCTCOUNT('TableA'[CustomerName])))

这将得出奇怪的 9 小计。

更多推荐

Power BI唯一计数不正确总计

本文发布于:2023-10-30 07:40:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1542210.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不正确   Power   BI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!