我正尝试使用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唯一计数不正确总计
发布评论