Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Javierco
Helper I
Helper I

DISTINCTCOUNT not returning the expected value

I have the following measure

 

 

 

 

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

 

 

 

 

and the following table

 

table.png

 

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:

 

table.png

 

Would much appreciate your help

 

 

4 REPLIES 4
DataVitalizer
Super User
Super User

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

Ashish_Mathur
Super User
Super User

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])

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
foodd
Super User
Super User

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.

 

foodd_3-1690932950466.png

 

foodd_0-1690932824551.png

foodd_1-1690932848736.png

 

 

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.