Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Help Using Contain Function for multiple criteria

sehgaln
8 - Asteroid

I am trying to use the contain function, but I have multiple criteria that I need to check for. 

 

An example is: If AA = '85' and MAC = '813' and USSGL = 488100 or 498100 then 0709. 

 

Is the expression below correct? Looks like the OR statement is throwing my output off. 

 

IF [AA] = "85" AND [MainAccountCode] = "813" AND Contains([USSGL], "488100") OR
Contains([USSGL], "498100")
THEN '0709'

4 REPLIES 4
Kenda
16 - Nebula
16 - Nebula

@sehgaln Put parenthesis around your or portion.

Also don't forget your else and endif parts of the formula.

Lastly, your fields will all have to be strings for your formula to work.

 

Here are those modifications I made to your formula:

IF [AA] = "85" AND [MainAccountCode] = "813" AND (Contains([USSGL],"488100") OR
Contains([USSGL], "498100"))
THEN '0709' ELSE null() ENDIF
sehgaln
8 - Asteroid

I checked all of that and it's still not populating correctly 

BenMoss
ACE Emeritus
ACE Emeritus

Can you please post your amended formula and also some sample data so we can test this.

 

Ben

BenMoss
ACE Emeritus
ACE Emeritus

The formula posted by @Kenda seems to function perfectly.

 

See the attached example.

 

2018-05-31_16-36-11.png

Labels
Top Solution Authors