In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

If function

Learner09
8 - Asteroid

Hello All,

 

I am trying to if a function in my existing model to add one logic but unfortunately it will not give me the expected results. Could anyone please see the details in the attached example and guide me?

2 REPLIES 2
Christina_H
14 - Magnetar

You need to change most of your AND to OR.  Or you could use an IN function instead if it's always an exact match (which it is in this sample).

 

IF [Type] = "YELLOW" AND
(Contains([Item],"ACTIVITIES") OR
Contains([Item], "DATA HUB") OR
Contains([Item],"ADVANCED") OR
Contains([Item], "SMB") OR
Contains([Item], "PEOPLE") OR
Contains([Item], "GAMES") OR
Contains([Item], "PARKS"))
THEN "RED"
ELSE [Type]
ENDIF

 

IF [Type] = "YELLOW" AND
[Item] IN("ACTIVITIES", "DATA HUB","ADVANCED", "SMB", "PEOPLE", "GAMES", "PARKS")
THEN "RED"
ELSE [Type]
ENDIF

Qiu
21 - Polaris
21 - Polaris

@Learner09 
as @Christina_H pointed out, we should use Or instead of And and also modify the [Type] = "RED" part since it will return a boolen value 0 or 1.

1208-Learner09.png

 

Labels
Top Solution Authors