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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
mbbui0721
New Member

IF SUM Statement DAX

Hello,

 

I'm fairly new to DAX. I'm tying to compare the TYPE of just Work Order Warranty and Warranty Transaction based on the total QTY of the item. If the Sum of QTY of Work Order Warranty is greater than Warranty Transactions then out "Fullfilled" else "Pending" as a new column. 

 

 

ORGDateItemTRX ValueQTYTYPE
11/1/2021A05178741054158Work Order Annual/Modular/Parts Rebuild
21/2/2021A05280020815975Work Order Repair
11/3/2021A05603263725.58Work Order Warranty
21/4/2021A05603263726.75Warranty Transaction
11/5/2021A0517874105418.97Work Order Annual/Modular/Parts Rebuild
21/6/2021A0528002081598.878Work Order Annual/Modular/Parts Rebuild
11/7/2021A05603263729.625Work Order Repair
11/8/2021A056032637210.378Work Order Warranty
      
1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@mbbui0721,

 

Try this calculated column. I'm not sure if you want "Pending" for every row that is not "Fulfilled", or for every row that is not "Fulfilled" and TYPE = "Work Order Warranty" or "Warranty Transaction". The DAX can be easily adjusted to accommodate either scenario.

 

Status = 
VAR vWorkOrderWarranty =
    CALCULATE (
        SUM ( Table1[QTY] ),
        ALLEXCEPT ( Table1, Table1[Item] ),
        Table1[TYPE] = "Work Order Warranty"
    )
VAR vWarrantyTransaction =
    CALCULATE (
        SUM ( Table1[QTY] ),
        ALLEXCEPT ( Table1, Table1[Item] ),
        Table1[TYPE] = "Warranty Transaction"
    )
VAR vResult =
    SWITCH (
        TRUE (),
        Table1[TYPE]
            IN { "Work Order Warranty", "Warranty Transaction" }
            && vWorkOrderWarranty > vWarrantyTransaction, "Fulfilled",
        Table1[TYPE]
            IN { "Work Order Warranty", "Warranty Transaction" }
            && vWorkOrderWarranty <= vWarrantyTransaction, "Pending"
    )
RETURN
    vResult

 

DataInsights_0-1628261280678.png

 





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@mbbui0721,

 

Try this calculated column. I'm not sure if you want "Pending" for every row that is not "Fulfilled", or for every row that is not "Fulfilled" and TYPE = "Work Order Warranty" or "Warranty Transaction". The DAX can be easily adjusted to accommodate either scenario.

 

Status = 
VAR vWorkOrderWarranty =
    CALCULATE (
        SUM ( Table1[QTY] ),
        ALLEXCEPT ( Table1, Table1[Item] ),
        Table1[TYPE] = "Work Order Warranty"
    )
VAR vWarrantyTransaction =
    CALCULATE (
        SUM ( Table1[QTY] ),
        ALLEXCEPT ( Table1, Table1[Item] ),
        Table1[TYPE] = "Warranty Transaction"
    )
VAR vResult =
    SWITCH (
        TRUE (),
        Table1[TYPE]
            IN { "Work Order Warranty", "Warranty Transaction" }
            && vWorkOrderWarranty > vWarrantyTransaction, "Fulfilled",
        Table1[TYPE]
            IN { "Work Order Warranty", "Warranty Transaction" }
            && vWorkOrderWarranty <= vWarrantyTransaction, "Pending"
    )
RETURN
    vResult

 

DataInsights_0-1628261280678.png

 





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

Proud to be a Super User!




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.