I'm attempting to derive an SLA Date Time in my data set ultimately for a datediff calculation, but I'm running into issues with my IF statement. What I'm trying to do is assign a different benchmark per group. My thought is to use the calculation below to create a string and then use the DATETIME tool to convert it back into the DATETIME format. Seems pretty simple, but I've been working on this for a few hours now and I can't seem to make it work.
IF [Group] = "GROUP 1"
THEN [RUN_DATE] +"15:00"
ELSEIF [Group] = "GROUP 2"
THEN [RUN_DATE] + "16:00"
ELSEIF [Group] = "GROUP 3"
THEN [RUN_DATE] + "17:00"
ELSE [Group] = "GROUP 4"
THEN [RUN_DATE] + "18:00"
ENDIF
I'm open to all suggestions, if there's a better way to attack this please let me know, as I'm pretty new to Alteryx.
Solved! Go to Solution.
Your line "ELSE [Group] = "GROUP 4"" should just be an else statement and the THEN on the next line isn't needed:
IF [Group] = "GROUP 1" THEN [RUN_DATE] +"15:00" ELSEIF [Group] = "GROUP 2" THEN [RUN_DATE] + "16:00" ELSEIF [Group] = "GROUP 3" THEN [RUN_DATE] + "17:00" ELSE [RUN_DATE] + "18:00" ENDIF
try looking at the switch statement as an alternate to the if then else.
This solved it. Thanks!