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

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

Reply
Anonymous
Not applicable

Distinct count with multiple conditions not working

Hi All,

 

 

I have a table with order data for the past 5 years.The dataset contains order details including order name,customer ID and total price.

 

I am now trying to Distinctcount all the orders(by order name) per customer however I only want to count the ones that have total value above 0.So if a customer has 6 orders in total and only 5 of them have value above 0 then I want it to filter that order out and not count it against the customers order.

 

I tried a couple of Dax syntaxes but none worked,i thought the last one would work but this didnt either.

 

orders per customer excluding 0 values= CALCULATE(
DISTINCTCOUNT(ORDERS_NEW[NAME]),FILTER('ORDERS_NEW'[EMAIL]) AND (ORDERS_NEW[TOTAL_PRICE]>0)
 
 
Has anyone ever come across the same issue.
 
 
Any help will be much appreciated 🙂
 
1 REPLY 1
ibarrau
Super User
Super User

Hi. It looks like your DAX expression syntax is wrong. You might want to try it this way:

orders per customer excluding 0 values = 
CALCULATE(
    DISTINCTCOUNT(ORDERS_NEW[NAME])
    , FILTER( 'ORDERS_NEW', ORDERS_NEW[TOTAL_PRICE] > 0 )
)

FILTER function first argument is the table to iterate checking the condition and the second argument is the condition. 

I hope that works.


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.