Forum Discussion
Alvarom1
Helper I
6 years agoHelp on DAX-DISTINCTOUNT
Hi I want to calculate a number of distinctcount for this table Letter Color a White a Red b White c White c Red d Red e White f g White g Red i ...
- 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
v-lili6-msft
Community Support
6 years agohi, 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
Alvarom1
Helper I
6 years agoIt works!
Thanks a lot
Alvaro