简体   繁体   English

DAX:使用多列的非重复计数

[英]DAX: distinct count using multiple columns

My table includes bunch of duplicated sales information for individual sellers, and I basically created a column and a measure which flags users whether the view they have includes duplicated sales information. 我的表包含一堆针对单个卖家的重复销售信息,并且我基本上创建了一个列和一个度量,用于标记用户是否具有重复销售信息的视图。

here is a very simplified example of what my table looked like 这是我的桌子看起来非常简单的例子

SalesManager  SalesPersonnel   Acccount   Product  Revenue
SalesManager1 SalesPersonnel1 Acccount_A Product_A 100000
SalesManager1 SalesPersonnel1 Acccount_B Product_C 100000
SalesManager1 SalesPersonnel3 Acccount_A Product_A 100000
SalesManager2 SalesPersonnel3 Acccount_B Product_C 100000
SalesManager1 SalesPersonnel2 Acccount_B Product_C 100000
SalesManager1 SalesPersonnel2 Acccount_B Product_C 100000
SalesManager4 SalesPersonnel4 Acccount_B Product_A 100000
SalesManager4 SalesPersonnel4 Acccount_A Product_D 100000
SalesManager4 SalesPersonnel5 Acccount_A Product_B 100000
SalesManager4 SalesPersonnel5 Acccount_A Product_A 100000

I then created a column 然后,我创建了一个专栏

=Acccount&Product&Revenue

This is an extremely simplified example, in my real workbook, I have 30+ columns that I have to combine. 这是一个极其简化的示例,在我的真实工作簿中,我必须合并30多个列。

and a measure 和措施

= if(CALCULATE(DISTINCTCOUNT([ConsldforDupeCheck]))=COUNTROWS(Table),"","*PossibleDoubleCountError*"

This has been working quite well, except I found that the calculated column that combines bunch of the columns is causing the file size to double... 这一直工作得很好,除了我发现结合了许多列的计算列导致文件大小加倍...

the only solution I can think of is if I can move the calculated column into measure, but I cannot think of a way to use distinctcount on multiple columns. 我能想到的唯一解决方案是,是否可以将计算出的列移动到度量中,但是我无法想到在多个列上使用distinctcount的方法。

Is this possible? 这可能吗?

Try this: 尝试这个:

My Distinct Count := COUNTROWS(
 SUMMARIZE('Your Table','Your Table'[Account],'Your Table'[Product],'Your Table'[Revenue])
)

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

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