Forum Discussion
Help on DAX-DISTINCTOUNT
- 6 years ago
hi, Alvarom1
You could try this way as below to get it:
Step1:
Create a measure that DISTINCTCOUNT different colors of each letter.
different colors each Letter = CALCULATE(DISTINCTCOUNT('Table'[Color]))Step2:
Create a measure that DISTINCTCOUNT while colors of each letter.
Only white each letter = CALCULATE(DISTINCTCOUNT('Table'[Letter]),FILTER('Table','Table'[Color]="White"))Step3:
Then use this measure to get your requirement:
Result = CALCULATE(DISTINCTCOUNT('Table'[Letter]),FILTER(VALUES('Table'[Letter]),[different colors each Letter]=[Only white each letter]))Result:
and here is sample pbix file, please try it.
Regards,
Lin
Thanks again, but with that I do not get the expected result that is the distinct count of letters that have ONLY "White", excluding the letters that have "White" and "Red" , that in this table are letters "b" and "e", that is 2 letters. Your formula gives me 5 as result but what I expect is 2
Makes it sense?
Thanks again!
Alvaro
hi, Alvarom1
You could try this way as below to get it:
Step1:
Create a measure that DISTINCTCOUNT different colors of each letter.
different colors each Letter = CALCULATE(DISTINCTCOUNT('Table'[Color]))
Step2:
Create a measure that DISTINCTCOUNT while colors of each letter.
Only white each letter = CALCULATE(DISTINCTCOUNT('Table'[Letter]),FILTER('Table','Table'[Color]="White"))
Step3:
Then use this measure to get your requirement:
Result = CALCULATE(DISTINCTCOUNT('Table'[Letter]),FILTER(VALUES('Table'[Letter]),[different colors each Letter]=[Only white each letter]))
Result:
and here is sample pbix file, please try it.
Regards,
Lin
- Alvarom16 years agoHelper I
It works!
Thanks a lot
Alvaro
- Alvarom16 years agoHelper I
HI Again,
as I confirmed, it works.
The issue that I have now is that the database is big and when it comes to calculate the last measure it takes a long time (several minutes) until the result appears.
Any idea to make it faster?
Thanks
Alvaro