In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

IF Statements with Multiple Conditions

krich434
6 - Meteoroid

Hi all,

 

Beating my head against the wall trying to figure out why this won't work. Using formula to create a new column called Aging for certain records. Past Due column is set to VSTRING and the values range from -40 to 650. This is the formula I created and I'm getting a Parse Error at char(548) Invalid Type in operator >=. (Expression #1) error. 

 

IF [Past Due] <= 0 Then "Current"
elseif ([Past Due]>0 AND [Past Due]<=15) Then "0-15 PCT"
elseif ([Past Due]>=16 AND [Past Due]<=30) Then "16-30 PCT"
elseif ([Past Due]>=31 AND [Past Due]<=60) Then "31-60 PCT"
elseif ([Past Due]>=61 AND [Past Due]<=90) Then "61-90 PCT"
elseif ([Past Due]>=91 AND [Past Due]<=180) Then "91-180 PCT"
elseif ([Past Due]>=181 AND [Past Due]<=365) Then "181-365 PCT"
elseif ([Past Due]>=366 AND [Past Due]<=730) Then "GT 1 Year PCT"
elseif ([Past Due]>=731 AND [Past Due]<=1095) Then "GT 2 Year PCT"
elseif [Past Due]>=1096 Then "GT 3 Year PCT"
else Null()
endif

 

What am I missing in this syntax? It's telling me the >=1096 is the issue. 

 

Thank you all for your help. 

2 REPLIES 2
binuacs
21 - Polaris

@krich434 since the[Past Due]  is string you need to use the numbers in quotes in the condition IF [Past Due] <= ‘0’ Then "Current" or

 

use the toNumber([Past Due]) function to convert the [Past Due] value to number

 

toNumber([Past Due] )<= 0 Then "Current"

krich434
6 - Meteoroid

Thank you very much! That solved my issue. 

Labels
Top Solution Authors