Alteryx Designer Desktop Discussions

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

IF AND FUNCTION

qgpl
8 - Asteroid

Hello 

 

Sorry this may be a really basic question but I am trying to do an "IF AND" with the below working formula - I need to add IF [TP Uplift]="-1" AND Contains(and then the rest of the below)... but I can't seem to get it to work. I have tried IF ELSEIF and IF(AND(... but it won't work. How would you do this? 

 

IF Contains([BOARDREP code], "STAFF",1)
THEN [Base Cost EUR] * (1 + [TP Uplift]) ELSE [Base Cost EUR]
ENDIF

 

Thank you!

 

3 REPLIES 3
alexnajm
18 - Pollux
18 - Pollux

IF Contains([BOARDREP code], "STAFF",1) AND [TP Uplift] = "-1"
THEN [Base Cost EUR] * (1 + [TP Uplift]) ELSE [Base Cost EUR]
ENDIF

cjaneczko
13 - Pulsar

Is [TP Uplift]="-1" a String field? If it isn't then you need to remove the quotes. This could be the issue you are having. Otherwise you should have no issue adding the AND. Seeing as you are performing a calculation on the field you likely need to remove the quotes as per below. 

 

 

IF [TP Uplift] = -1 AND Contains([BOARDREP code], "STAFF",1)
THEN [Base Cost EUR] * (1 + [TP Uplift]) ELSE [Base Cost EUR]
ENDIF

 

Raj
16 - Nebula

I think you had a solution in the question
just nest the AND condition in Starting
 
IF Contains([BOARDREP code], "STAFF",1) AND [TP Uplift]="-1"
THEN [Base Cost EUR] * (1 + [TP Uplift]) ELSE [Base Cost EUR]
ENDIF

Labels
Top Solution Authors