Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

IF ELSE Statement Using Three Columns

TheSham_
5 - Atom

Hi everyone,

I'm new to Alteryx and have a question. I need to create a new column called LAUNCH DATE, which will display results based on three existing columns: TARGET_LAUNCH_DATE, REVISED_LAUNCH_DATE, and ACTUAL_LAUNCH_DATE.

The conditions are as follows:

If the project only has TARGET_LAUNCH_DATE, it will display TARGET_LAUNCH_DATE in the LAUNCH DATE column.
If the project only has REVISED_LAUNCH_DATE, it will display REVISED_LAUNCH_DATE.
If the project only has ACTUAL_LAUNCH_DATE, it will display ACTUAL_LAUNCH_DATE.
If the project has both TARGET_LAUNCH_DATE and REVISED_LAUNCH_DATE, it will display REVISED_LAUNCH_DATE.
If the project has both REVISED_LAUNCH_DATE and ACTUAL_LAUNCH_DATE, it will display ACTUAL_LAUNCH_DATE.
If the project has TARGET_LAUNCH_DATE, REVISED_LAUNCH_DATE, and ACTUAL_LAUNCH_DATE, it will display ACTUAL_LAUNCH_DATE.

(Please refer to the attached sample for clarity.)

Sample.png

I’ve tried using the If else statement in the Formula Tool in Alteryx, and this is the expression I used:


IF !IsNull([ACTUAL_LAUNCH_DATE]) THEN
[ACTUAL_LAUNCH_DATE]
ELSEIF IsNull([ACTUAL_LAUNCH_DATE]) AND !IsNull([REVISED_LAUNCH_DATE]) THEN
[REVISED_LAUNCH_DATE]
ELSEIF IsNull([ACTUAL_LAUNCH_DATE]) AND IsNull([REVISED_LAUNCH_DATE]) AND !IsNull([TARGET_LAUNCH_DATE]) THEN
[TARGET_LAUNCH_DATE]
ELSE  ''
ENDIF


However, the output only displays the ACTUAL_LAUNCH_DATE part, and the rest of the conditions don’t seem to work. Attached is the output from my workflow.

Ouput in Alteryx.png

 

Does anyone know how to solve this? I’d really appreciate the help!

4 REPLIES 4
alexnajm
18 - Pollux
18 - Pollux

Change all your IsNull functions to IsEmpty - the grey in your header indicates Empty cells instead of null cells!

TheSham_
5 - Atom

I've updated the IsNull functions to IsEmpty and the conditions are now working perfectly. Thanks for pointing that out! Really appreciate your help :D

alexnajm
18 - Pollux
18 - Pollux

Fantastic news!

SPetrie
13 - Pulsar

I know this has already been answered, but I wanted to also let you know that if you have a newer version of Designer, you can use the coalesce function instead to get the first non-null value.

Coalesce([Actual_LaunchDate],[Revised_Launch_Date],[Target_Launch_Date]) would take the place of the if,then,else statements. It only works for nulls though, so you need to clean up empties first.

coalesce.PNG

Labels
Top Solution Authors