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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply

distinctcount getting multiple hits

Hello! 

I'm trying to get the distinct count function to determine the number of distinct batches we have made. I've used the following logic:

 

 

 

 

 

Unique Batches = CALCULATE (
    DISTINCTCOUNT ('Production'[BatchNum]))

 

 

 

 

 

And when I click in the sample data on each batch, I can see that in most cases, it's working.  For example, B10059 has two batch numbers but is only counted as one, which is expected.

 

formerlyknownas_1-1611593092757.png

 

However, there are a few where it's simply not working.  Here, it's counted three times

 

formerlyknownas_2-1611593248310.png

 

 

Querying the data, I don't see any issue with formatting. BatchNum is definitley the same and should only be counted once.  There are three hits in the data set, but that shouldn't matter in this case if BatchNum has the same value.

 

formerlyknownas_3-1611593515214.png

 

Any idea why I'm not always gettign a distinct count in Power BI? Many thanks in advance. 

 

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @formerlyknownas ,

 

Can you try using the following measure instead?

Unique Batches = DISTINCTCOUNT('Production'[BatchNum])

 

There may be a context issue with the previous version.

 

Pete 



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2

Thanks, Pete. I made a new measure according to your suggestion, and it worked. I don't think I created a proper measure the first time around.

 

Eric

BA_Pete
Super User
Super User

Hi @formerlyknownas ,

 

Can you try using the following measure instead?

Unique Batches = DISTINCTCOUNT('Production'[BatchNum])

 

There may be a context issue with the previous version.

 

Pete 



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors