Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Simple IF statement returning wrong results.

CRogers22
8 - Asteroid

Hello and thank you in advance for your time.

 

I'm running a simple IF Statement 

 

IF [Days 1]<='30' Then 'Pass'
Else 'Fail' ENDIF

 

But in the results its showing 7 , 9 days etc., as a fail. Then in some cases it's retuning the correct result and all the fails are returning the correct results.

 

any ideas what I'm doing wrong?

 

Thanks again

4 REPLIES 4
binuacs
21 - Polaris

@CRogers22  to Number([Days 1]) <= 30 Then 'Pass' Else 'Fail' EndIf

 

7 and 9 are less than 30 which is correct as per your logic

 

 

Raj
16 - Nebula

@CRogers22 
if Yous days 1 is a numeric filed there is no need of adding '30' and this is causing error

update your formula
IF [Days 1]<=30 Then 'Pass'
Else 'Fail' ENDIF

hope this helps.

CRogers22
8 - Asteroid

When I use this formula I get a Parse Error at Char (18); Invalid type in operator <=.

LindonB
11 - Bolide

If [Days 1] is a string, then use this....
IF ToNumber([Days 1])<=30 Then 'Pass'
Else 'Fail' ENDIF

 

If it is a numeric value, use this....

IF [Days 1]<=30 Then 'Pass'
Else 'Fail' ENDIF

Labels