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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
Solution Sage
Solution Sage

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors