Forum Discussion

Javierco's avatar
Javierco
Icon for Helper I rankHelper I
3 years ago

DISTINCTCOUNT not returning the expected value

I have the following measure

 

 

 

 

DistinctOcc = CALCULATE(DISTINCTCOUNT(table1[pos_id_cen]))

 

 

 

 

and the following table

 

 

Why DistinctOcc is = 2

 

I was expecting to be =1, but cannot figure out what's wrong.

 

BTW, If I take out the sku_id field I get:

 

 

Would much appreciate your help

 

 

4 Replies

  • foodd's avatar
    foodd
    Icon for Community Champion rankCommunity Champion

    When I run this using the same table data, and the same measure, it calculates correctly.
    The DistinctPosIDCount measure returns a value of 1, as there is only one unique

    value (7701001482309) in the "pos_id_cen" column.

     

     

     

     

     

    • Javierco's avatar
      Javierco
      Icon for Helper I rankHelper I

      Thanks. I imported the data again using a blank pbix and the measure is working as expected. Seems like it is related with the table relationships in the original pbix or the processing done after importing (or both). Will do a few more tests

  • Hi,

    There could be some special character in one of the ID's.  Also, you may simplify your measure to

    DistinctOcc = DISTINCTCOUNT(table1[pos_id_cen])
  • Hi Javierco 

    I tried to generate the same issue but everytime I get the correct result.

    Could you share the pbix?


    Did it work 👍 A kudos would be appreciated ‌‌📢 Mark it as a solution to help spreading knowledge