Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Multiple Conditions in Formula

emiafshar
8 - Asteroid

Hi,

 

I am trying to use multiple "IF" formulas on a data set but it is only picking up the last formula (ICCT4 - as seen in results window)

 

SOS!

 

 

alteryx.PNG

 

4 REPLIES 4
WilliamR
Alteryx
Alteryx

You can use a switch formula: Switch(Value,Default,Case1,Result1,...,CaseN,ResultN) instead of multiple if.

https://help.alteryx.com/2018.2/Reference/Functions.htm

 

emiafshar
8 - Asteroid

@WilliamR wrote:

You can use a switch formula: Switch(Value,Default,Case1,Result1,...,CaseN,ResultN) instead of multiple if.

https://help.alteryx.com/2018.2/Reference/Functions.htm

 


Hi William,

 

Thanks for getting back to me.

 

How would the Switch formula work as I can't seem to figure out what the Default, CaseN fields would include?

 

Thanks!

JoeS
Alteryx
Alteryx

You can also use ELSEIF.

 

So you could put all 4 of those into one:

 

IF [Zeus] = "265" THEN "ICCT1"
ELSEIF [Zeus] = "266" THEN "ICCT2"
ELSEIF [Zeus] = "290" THEN "ICCT3"
ELSEIF [Zeus] = "190" THEN "ICCT4"
ELSE "pending"
ENDIF

 

WilliamR
Alteryx
Alteryx

Hi @emiafshar,

the syntax would be 

Switch([Zeus],Null(),265,"ICCT1",266,"ICCT2",290,"ICCT3",....)

The Default value is used in the case where there is no associated value for one record, the default value would be used, so you can replace Null() by the value you want in this case.

Hope this help.

Labels