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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sstaton6005
New Member

How to SumIf with multiple columns in DAX

I am hitting a wall and cannot figure out how to return a result where I could in Excel. 

 

My data shows whether steps in a process have been completed. A violation would be if the Status is complete, but not all steps were completed. I want to be able to show violations. In the example below, row 3 & 4 would be a violation. I need to count how many violations I have. 

 

Pre work required docsequipment checkfinal run throughapproval to proceedStatus
donedonependingdonedonePlanning
donedonedonedonedoneCompleted
donedonependingpendingdoneCompleted
pendingdonedonedonedoneCompleted
2 ACCEPTED SOLUTIONS
kpost
Super User
Super User

screenshot1.PNG

 

First way:  Measure using DAX

violation_count =
COALESCE(
    SUMX(
        'Table_Name',
        IF([Status] = "Completed" && ([A] <> "done" || [B] <> "done" || [C] <> "done"), 1, 0)
        ),
        0)

Second way, custom column using M in Power Query:

 

if ([Status] = "Completed") and ( [A] <> "done" or [B] <> "done" or [C] <> "done" ) then 1 else 0

 

Then sum this column in the Power BI report.

 

You will have to change where it says "A", "B", "C" etc. with the names of your columns.

 

See attached .pbix file with the solution(s).

 

screenshot2.PNG

 

There's probably a few ways to do this but....

 

///Mediocre Power BI advice, but it's free///

View solution in original post

It's not DAX,  I did it in Power Query using the "M" language.

 

Here's the same thing as a custom column using DAX language, you'll still have to sum it:

 

Violation_DAX_COLUMN =
    IF([Status] = "Completed" && ([A] <> "done" || [B] <> "done" || [C] <> "done"), 1, 0)
 
 
 
And here's the same thing using a single measure rather than creating a custom column and summing it:

violation_count_MEASURE =
COALESCE(
    SUMX(
        'Table_Name',
        IF([Status] = "Completed" && ([A] <> "done" || [B] <> "done" || [C] <> "done"), 1, 0)
        ),
        0)

View solution in original post

8 REPLIES 8
v-tsaipranay
Community Support
Community Support

Hi @sstaton6005 ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

v-tsaipranay
Community Support
Community Support

Hi @sstaton6005 ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

v-tsaipranay
Community Support
Community Support

Hi @sstaton6005 ,

Thanks for reaching out to the Microsoft fabric community forum.



I wanted to check if you had the opportunity to review the information provided by @kpost . Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

 

rajendraongole1
Super User
Super User

Hi @sstaton6005 - please find the attached pbix with solution.

 

rajendraongole1_0-1744907924040.png

 

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





I'm sorry, I"m not sure what the DAX query is that you used or how you did that. 

kpost
Super User
Super User

screenshot1.PNG

 

First way:  Measure using DAX

violation_count =
COALESCE(
    SUMX(
        'Table_Name',
        IF([Status] = "Completed" && ([A] <> "done" || [B] <> "done" || [C] <> "done"), 1, 0)
        ),
        0)

Second way, custom column using M in Power Query:

 

if ([Status] = "Completed") and ( [A] <> "done" or [B] <> "done" or [C] <> "done" ) then 1 else 0

 

Then sum this column in the Power BI report.

 

You will have to change where it says "A", "B", "C" etc. with the names of your columns.

 

See attached .pbix file with the solution(s).

 

screenshot2.PNG

 

There's probably a few ways to do this but....

 

///Mediocre Power BI advice, but it's free///

Thanks for trying! It keeps saying that the syntax for AND is incorrect. I've tried copying and pasting your suggestion as well as retyping my own. 

It's not DAX,  I did it in Power Query using the "M" language.

 

Here's the same thing as a custom column using DAX language, you'll still have to sum it:

 

Violation_DAX_COLUMN =
    IF([Status] = "Completed" && ([A] <> "done" || [B] <> "done" || [C] <> "done"), 1, 0)
 
 
 
And here's the same thing using a single measure rather than creating a custom column and summing it:

violation_count_MEASURE =
COALESCE(
    SUMX(
        'Table_Name',
        IF([Status] = "Completed" && ([A] <> "done" || [B] <> "done" || [C] <> "done"), 1, 0)
        ),
        0)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.