Alteryx Designer Desktop Discussions

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

IF Function Assistance

wpatino15
6 - Meteoroid

Hello,

 

I am currently working on a workflow and am in need of some assistance. I want to run a test to see whether a value is above a certain threshold. The function that I am using is as follows:

 

If [Value] >= "470" then "1" else "0" endif

 

It seems like an easy function to use, but for some reason it isn't properly functioning. For certain values, it gets me a 0 while it should send back a 1. Certain values are listed below as reference:

 

Value         Test

1610            0

2552            0

738              1

516              1

988              1

4                  0

306              0

 

Not sure if there is a better formula to use for this situation. Any assistance in resolving this problem would be greatly appreciated!

4 REPLIES 4
CharlieS
17 - Castor
17 - Castor

@wpatino15

 

Make sure the [Value] field is formatted as a numeric field. When a field is a string type, the characters are evaluated in a sequential order (think alphabetic methodology, but with numbers). 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@wpatino15,

 

@CharlieS is on the right track, but I know that he's right!  The > "470" proves it.

 

please do either convert to a number (e.g. INT16) or use:

 

If ToNumber([Value]) >= 470 then "1" else "0" endif

Cheers,

Mark

 

P.S.  If this new variable is a BYTE, then:

If ToNumber([Value]) >= 470 then 1 else 0 endif
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
wpatino15
6 - Meteoroid

That worked! Thank you so @CharlieS and @MarqueeCrew for your assistance.

MarqueeCrew
20 - Arcturus
20 - Arcturus

@wpatino15,

 

Please mark @CharlieS's response too as a solution.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels