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
Anonymous
Not applicable

Easy Question - distinct count problem

Hello -  I am trying to solve a fairly basic problem, but my measure is not giving me the correct result.  

 

I need to count the number of distinct shipments per day (or month, etc) based on the Order #.    Then I will display the total in a card visual.   So in my example below, the correct count should be 4.    An order can have multiple lines, but as long as they ship on the same day, it is counted as one shipment.     Below you can see there are 4 distinct order numbers, all shipped on Jan 9.   

 

There are occassions were a line item from an order can ship later or earlier than other lines from that Order.   That is why I need a distinct count using the Order #.     

 

For whatever reason, my current formula is giving me the number 12 and I have no idea why. 

 

Total AR Shipments = CALCULATE(DISTINCTCOUNT('Flu Shipped'[Order]),FILTER('Flu Shipped','Flu Shipped'[Date Shipped]))

AR shipments.png

6 REPLIES 6
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could try to use "ALLEXCEPT" to replace "FILTER". 

Maybe your problem is not in the formula, you could share your sample data and excepted result to me if you don't have any confidential information. Please upload your files to OneDrive and share the link here.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
SpiroswayGR
Resolver III
Resolver III

Hey @Anonymous 

You can create a new table without duplications (key number will be your order number) and then you can easily count the distict orders per day.

Anonymous
Not applicable

I am not trying to count the number of distinct orders.   

 

I am trying to count the number of shipments per day  (tied to a distinct order number).  

@Anonymous 

Well if you have distict orders you will get the number that you need.

Otherwise maybe you can create a new key that might include order number / date in ascii format and then calculate unique shipments per unique orders by date.

Anonymous
Not applicable

Yes, I see what you're saying now.  

 

But shouldn't my formula above give the correct result?   I'd like to do this formulaicly without creating another table (or using the filters in the filter area).    I thought by creating a measure using distinctcount it would filter the order numbers down to their distinct values already.   

yes as i see , it's supposed to return correct results.

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