Forum Discussion

Alvarom1's avatar
Alvarom1
Helper I
6 years ago
Solved

Help 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 ...
  • v-lili6-msft's avatar
    v-lili6-msft
    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