The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
ORG | Date | Item | TRX Value | QTY | TYPE |
1 | 1/1/2021 | A051787410541 | 5 | 8 | Work Order Annual/Modular/Parts Rebuild |
2 | 1/2/2021 | A052800208159 | 7 | 5 | Work Order Repair |
1 | 1/3/2021 | A0560326372 | 5.5 | 8 | Work Order Warranty |
2 | 1/4/2021 | A0560326372 | 6.7 | 5 | Warranty Transaction |
1 | 1/5/2021 | A051787410541 | 8.9 | 7 | Work Order Annual/Modular/Parts Rebuild |
2 | 1/6/2021 | A052800208159 | 8.87 | 8 | Work Order Annual/Modular/Parts Rebuild |
1 | 1/7/2021 | A0560326372 | 9.62 | 5 | Work Order Repair |
1 | 1/8/2021 | A0560326372 | 10.37 | 8 | Work Order Warranty |
Solved! Go to Solution.
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
Proud to be a Super User!
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
Proud to be a Super User!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
77 | |
71 | |
47 | |
39 |
User | Count |
---|---|
136 | |
108 | |
70 | |
64 | |
57 |