Forum Discussion
tortugamarina
5 years agoFrequent Visitor
DAX - Measure to count distinct values when countrows with same ID is 2
Hi all, I am trying to calculate: 1) Number of Departments where each customer has bought 2) For those customers who bought in 2 different departments, what is the total count of those departme...
amitchandak
5 years agoSuper User
tortugamarina , While showing at department level you have to igonre department filter .
example
Two Dep Count Distinct =
calculate(COUNTROWS (FILTER (VALUES (cust[customerID]), CALCULATE([Count Distinct Dep]=2) )), filter(allselected(cust), Table[cust] = max(Table[cust])))
tortugamarina
5 years agoFrequent Visitor
Hi,
I don“t get the result desired. In fact, MAX function is not possible to use with a Table, but needs a specific column, and if I replace the cust for cust[customerID] it results in blank:
Two Dep Count Distinct =
calculate(COUNTROWS (FILTER (VALUES (cust[customerID]), CALCULATE([Count Distinct Dep]=2) )), filter(allselected(cust), cust[customerID] = max(cust[customerID])))