community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Multi-Condition IF THEN ELSE statement

Meteor

Hi guys, I'm trying to create an If statement with 3 conditions.

 

But cant get it to work, basically I'm wanting a new column with a Y/N depending on the three previous column rules ("Y", "N", "N" = "Y")

 

i.e. IF [x]="Y" THEN "Y" ELSEIF [x2]="N" THEN "Y" ELSEIF [x3]="N" THEN "Y" ELSE "N" ENDIF

 

Any ideas where I am going wrong?

Alteryx Certified Partner
Alteryx Certified Partner
Hi Matt,

It's not clear exactly what your issue is here? Are you getting an incorrect syntax issue or is your logic statement just not working how you want?

If the latter can you please share a few sample lines and the desired result.

Ben
Meteor

Hi Ben,

 

The error reads: "Parse Error at char(0)L Invalid type in operator ==.(Expression #1)

 

This is the written formula: IF [2 Case EOQ?]="Y" THEN "Y" ELSEIF [Days Cover Filter]="N" THEN "Y" ELSEIF [Case More Than £50?]="N" THEN "Y" ELSE "N" ENDIF

Alteryx Certified Partner
Alteryx Certified Partner

Okay, so this is because your fields are not strings; could you check the datatype of the fields prior to your formula tool? Perhaps they are set to bool? In which case your statement needs to look something like...

 

IF [2 Case EOQ?] THEN "Y" ELSEIF ![Days Cover Filter] THEN "Y" ELSEIF ![Case More Than £50?] THEN "Y" ELSE "N" ENDIF

With bool fields Alteryx will automatically check for a positive class hence [2 Case EOQ?] alone. If I want to check the negative class then I can add an exclamation mark in front.

 

Ben

Meteor

Hi Ben,

 

Thanks for the help, that has worked!!

Labels