Alteryx Designer Desktop Discussions

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

Multi-Conditional ELSEIF statement

Ana_Brantley
5 - Atom

Hello,

 

I am new to Alteryx and am trying to build a multi-conditional ELSEIF statement. It reads as follows:

 

IF [Age] <= "30" THEN "0-30"

ELSEIF [Age] <= "60" THEN "30-60"

ELSEIF [Age] <= "90" THEN "60-90"

ELSE [Age]="90+"

ENDIF 

 

When I try to type the "ENDIF" if removes the color and reads an error message. The [Age] column is currently a Double format (previously created in workflow using formula tool: (DateTimeDiff([Cash_Receipt_Date],[Sales_Order_Date],"days") and the new column I am trying to create is a V_Wstring format. I am not sure what I am doing wrong! Thank you. 

5 REPLIES 5
apathetichell
18 - Pollux

doubles are measured against numbers so:

[age]<=30 if [age] is a double. You don't need the quotes for the comparison. You will need the quotes for what you are adding to the new string.

 

Also - your last clause attempts to assign a value to [age] instead of what I believe is the new column you are trying to create. Since you are using vwstring you cannot put it back in [age] and change [age] to a vwstring in your formula tool.

 

so change the comparison to not include quotes, turn this into a new column, and change the last clause to assign "90+" to your new column - not to [age]

Qiu
20 - Arcturus
20 - Arcturus

@Ana_Brantley 

 

<=> only apply to numeric data, so 

try to remove the double quotation as below

IF [Age] <= 30 THEN "0-30"

ELSEIF [Age] <= 60 and  [Age] > 30  THEN "30-60"

ELSEIF [Age] > 60 and [Age] <= 90 THEN "60-90"

ELSE  "90+"

ENDIF 

Capture1A.PNG

Ana_Brantley
5 - Atom

Thank you so much!

Qiu
20 - Arcturus
20 - Arcturus

@Ana_Brantley 

Glad to help and thank you for the accept mark. 😁

SWickerson
5 - Atom

Figured it out.

Labels