Forum Discussion

Narender's avatar
Narender
Resolver I
8 years ago
Solved

How to count distinct values ?

Hi All,

 

I want to calculate distinct count of my column in measure.

 

like:

 

Measure 2 = DISTINCTCOUNT((TAX_TRANSACTION[TAX_PAYER_NO]))

This showing wrong result as i compared with my sql query result.

 

Without distinct is showing right result

COUNT((TAX_TRANSACTION[TAX_PAYER_NO])) is showing right result as i compared with my sql query result.

 

Please let me know, how can i write expression in dax for distinct count??

 

 

Thanks

 

Narender

  • Hi All,

     I got the reason of wrong value.

     

    Measure 2 = DISTINCTCOUNT((TAX_TRANSACTION[TAX_PAYER_NO]))

     

    I was using 2 square brackets'(('  but I have to use 1 square bracket '('

     

     

     

    Measure 2 = DISTINCTCOUNT(TAX_TRANSACTION[TAX_PAYER_NO]).

     

    :)

     

    Thanks everyone.

     

    Narender

5 Replies

  • Hi All,

     I got the reason of wrong value.

     

    Measure 2 = DISTINCTCOUNT((TAX_TRANSACTION[TAX_PAYER_NO]))

     

    I was using 2 square brackets'(('  but I have to use 1 square bracket '('

     

     

     

    Measure 2 = DISTINCTCOUNT(TAX_TRANSACTION[TAX_PAYER_NO]).

     

    :)

     

    Thanks everyone.

     

    Narender

    • v-chuncz-msft's avatar
      v-chuncz-msft
      Community Support

      Narender,

       

      By the way, you may help accept the solution above. Your contribution is highly appreciated.

  • Hi,

    Your DAX staement is correct. Ideally it should show the right values

  • Anonymous's avatar
    Anonymous
    Not applicable

    Narender,

    Do you have blank values in the column?  Those have an effect on the output and might be the reason for the difference...

     

     

     

     

     

     

    Br,

    T