Forum Discussion
Munawar1881
4 years agoHelper II
IF Condition
Hi, I have two dates 1. Shipment Date 2. Actual Shipment Date with Order Quantities. Now want to have IF condition where I can get the status if it is shipped Early (with number of days) , On Tim...
- 4 years ago
Munawar1881 write this calculated column:
Status = VAR _days = ABS(DATEDIFF('Table'[Shipment Date], 'Table'[Actual Shipment Date], DAY)) RETURN SWITCH( TRUE(), 'Table'[Shipment Date] < 'Table'[Actual Shipment Date], "Delay by " & _days & IF(_days = 1, " day", " days"), 'Table'[Shipment Date] > 'Table'[Actual Shipment Date], "Early by " & _days & IF(_days = 1, " day", " days"), "On Time" )
Here is a link to download the file with the solution:
IF Condition 2022-08-02.pbix - 4 years ago
Munawar1881 change the code to this:
Status = VAR _days = ABS(DATEDIFF('Table'[Shipment Date], 'Table'[Actual Shipment Date], DAY)) RETURN SWITCH( TRUE(), 'Table'[Actual Shipment Date] = BLANK(), "On Time", 'Table'[Shipment Date] < 'Table'[Actual Shipment Date], "Delay by " & _days & IF(_days = 1, " day", " days"), 'Table'[Shipment Date] > 'Table'[Actual Shipment Date], "Early by " & _days & IF(_days = 1, " day", " days"), "On Time" ) - 4 years ago
Munawar1881 here is a link to download the file with the solution:
IF Condition 2022-08-02.pbix
Munawar1881
4 years agoHelper II
If the oder is shipped in shipped date and actual shipment date is empty. normally It should be On Time but it shows delay. please guide me how can I solve it
SpartaBI
4 years agoCommunity Champion
Munawar1881 change the code to this:
Status =
VAR _days = ABS(DATEDIFF('Table'[Shipment Date], 'Table'[Actual Shipment Date], DAY))
RETURN
SWITCH(
TRUE(),
'Table'[Actual Shipment Date] = BLANK(), "On Time",
'Table'[Shipment Date] < 'Table'[Actual Shipment Date], "Delay by " & _days & IF(_days = 1, " day", " days"),
'Table'[Shipment Date] > 'Table'[Actual Shipment Date], "Early by " & _days & IF(_days = 1, " day", " days"),
"On Time"
)