DAX: distinct count using multiple columns

半腔热情 提交于 2021-01-28 06:12:39

问题


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.

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.

Is this possible?


回答1:


Try this:

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


来源:https://stackoverflow.com/questions/34870216/dax-distinct-count-using-multiple-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!