Alteryx Designer Desktop Discussions

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

Multiple IF THEN statement with multiple AND and OR functions

all-tricks-rick
6 - Meteoroid

I am trying to write a formula expression that basically pulls all rows that include the certain items from three distinct columns. See formula below - these are financial type "futures", swap type "security" and any of the 5 business units listed within the formula below. Right now, the only business unit that is included is the last "QRST", but i know that data should be pulling for the first four business units as well. Can anyone help me update my formula? Not sure why this is happening. Thanks!

 

IF [Financial Type]="FUTURES" and [Swap Type] ="Security" and [Business Unit Name] ="ABCD" or [Financial Type]="FUTURES" and [Swap Type] ="Security" and [Business Unit Name]="EFGH" or [Financial Type]="FUTURES" and [Swap Type] ="Security" and [Business Unit Name]="IJKL" or [Financial Type]="FUTURES" and [Swap Type] ="Security" and [Business Unit Name]="MNOP" or [Financial Type]="FUTURES" and [Swap Type] ="Security" and [Business Unit Name]="QRST" THEN "Futures - Energy" ELSE "No" ENDIF

2 REPLIES 2
patrick_digan
17 - Castor
17 - Castor

@all-tricks-rick Try something like this using an In statement:

IF [Financial Type]="FUTURES" and [Swap Type] ="Security" and [Business Unit Name] IN("ABCD","EFGH",.....,"QRST") Then "Futures - Energy" Else "No" Endif

EDIT: For What it's worth, I would also replace the IF statement with an IIF

 

IIF([Financial Type]="FUTURES" and [Swap Type] ="Security" and [Business Unit Name] IN("ABCD","EFGH",.....,"QRST"),"Futures - Energy","No")
all-tricks-rick
6 - Meteoroid

That works - thank you!

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels