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
JajatiDev
Helper II
Helper II

DAX to count number of rows with multiple conditions

Hi

Here is my order table;

Order NoSO LinesShipping Condition
1000110Ship as available
1000120Ship as available
1200210Ship complete
1200220Ship complete
1300110Ship as available
1300120Ship as available
1300130Ship as available
1400110Ship as available

 

If the shipping condition is 'Ship as available' then each of the order lines is treated separately. While if the order has the shipping condition as 'Ship complete' then the order is treated as 1 and all order lines need to ship together. This means in the above table I have 7 order lines.

 

I need assistance with the measures;

1. that counts the number of order lines based on shipping conditions, and

2. the other that just gives me the sum total of the count of order lines

 

Thanks and Regards

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please try the below measures, and check the attached pbix file.

 

Count based on the condition measure: = 
VAR available_table =
    FILTER ( Data, Data[Shipping Condition] = "Ship as available" )
VAR complete_table =
    FILTER (
        SUMMARIZE ( Data, Data[Order No], Data[Shipping Condition] ),
        Data[Shipping Condition] = "Ship complete"
    )
RETURN
    COUNTROWS ( available_table ) + COUNTROWS ( complete_table )

 

Count measure: = 
COUNTROWS( Data )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
JajatiDev
Helper II
Helper II

Hi Jihwan_Kim,

Thank you. The DAX function shared is working as expected.

 

Regards,

Jajati Dev

Jihwan_Kim
Super User
Super User

Hi,

Please try the below measures, and check the attached pbix file.

 

Count based on the condition measure: = 
VAR available_table =
    FILTER ( Data, Data[Shipping Condition] = "Ship as available" )
VAR complete_table =
    FILTER (
        SUMMARIZE ( Data, Data[Order No], Data[Shipping Condition] ),
        Data[Shipping Condition] = "Ship complete"
    )
RETURN
    COUNTROWS ( available_table ) + COUNTROWS ( complete_table )

 

Count measure: = 
COUNTROWS( Data )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.