Forum Discussion
IF Condition
- 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 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
It works. Thak you so much for your help
- SpartaBI4 years agoCommunity Champion
my pleasure 🙂
Check out my showcase report - got some high level stuff there. Sure you will find there a lot of cool ideas. Please give it a thumbs up over there if you liked it 🙂
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543- Munawar18814 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
- SpartaBI4 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" )