Forum Discussion
multiple ifs
Hi, i have multiple conditions, how is this doable in power bi?
IF
([SCHEDULE_SHIP_DATE] < TODAY() OR [SCHEDULE_SHIP_DATE] < TODAY() + 2)
THEN 'Today'
ELSEIF ([SCHEDULE_SHIP_DATE] < TODAY() OR
[SCHEDULE_SHIP_DATE] < TODAY() + 2 OR
[SCHEDULE_SHIP_DATE] < TODAY() + 6)
THEN 'N5D'
ELSEIF ([SCHEDULE_SHIP_DATE] < TODAY() + 13)
THEN 'N2W'
END
4 Replies
- Samarth_18Community Champion
Hi Anonymous ,
You can use below code:-
column = IF ( OR ( [SCHEDULE_SHIP_DATE] < TODAY (), [SCHEDULE_SHIP_DATE] < TODAY () + 2 ), "Today", IF ( OR ( [SCHEDULE_SHIP_DATE] < TODAY (), OR ( [SCHEDULE_SHIP_DATE] < ( TODAY () + 2 ), [SCHEDULE_SHIP_DATE] < ( TODAY () + 6 ) ) ), "N5D", IF ( [SCHEDULE_SHIP_DATE] < ( TODAY () + 13 ), "N2W" ) ) )Thanks,
Samarth
- AnonymousNot applicable
hi Samarth_18 the formula you suggested seems to not be working on the output i desire.
this formula:
SSD = IF('Open Orders_BOM'[SCHEDULE_SHIP_DATE] < TODAY(),"Backlog",IF('Open Orders_BOM'[SCHEDULE_SHIP_DATE] < TODAY() + 2,"Today",IF('Open Orders_BOM'[SCHEDULE_SHIP_DATE]< TODAY() + 6,"N5D","Future")))is actually the reference to be used, i want to modify that formula into a new classification:
New Column (DESIRED OUTPUT):
N5D will cover all "Backlog" , "N5D", "Today"
Today will cover "Backlog","Today"
Future will be "N2W"- Samarth_18Community Champion
For your first condition i.e. N5D will cover all "Backlog" , "N5D", "Today", if SSD = N5D then it will show N5D but it will show N5D for backlog and today as well since we have applied OR condition. N5D and Today cant go in parellel in such case. Could you please check if we are missing any other condition?
- AnonymousNot applicable
Hi Anonymous ,
You could try SWITCH() function.
https://docs.microsoft.com/en-us/dax/switch-function-dax
However, the second condition look wired.
([SCHEDULE_SHIP_DATE] < TODAY() OR [SCHEDULE_SHIP_DATE] < TODAY() + 2) could be both "Today" and "N5D"?
Best Regards,
Jay