Alteryx Designer Desktop Discussions

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

Error in Formula

SACResearch
6 - Meteoroid

Hi!

I am trying to do the following formula, but getting an "invalid type in operator >" message. Can someone please tell me what I'm doing wrong?

 

 

IF [% of Courses Completed]=0 THEN "No Classes Completed" ELSEIF [% of Courses Completed] >0.00 AND [% of Courses Completed] <0.25 THEN "1% to 24% of Classes Completed" ELSEIF [% of Courses Completed] >0.24 AND [% of Courses Completed] <0.50 THEN "25% to 49% of Classes Completed" ELSEIF [% of Courses Completed] >0.49 AND [% of Courses Completed] <0.75 THEN "50% to 74% of Classes Completed" ELSEIF [% of Courses Completed] >0.74 AND [% of Courses Completed] <1.00 THEN "75% to 99% of Classes Completed" ELSE "All Classes Completed"
ENDIF

 

 

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

if the incoming field is a STRING, that is the message that you should expect.  maybe there is some 'junk' in there that you would want to cleanup and make sure that the incoming field is cast as a double?

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
JohnJPS
15 - Aurora

I tried your formula and it worked great on numeric data. The instant I added a non-numeric value to my Text Input, it gave me your error.

 

So, maybe have a look at the data coming in and ensure that it is numeric.

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

Here's a bonus answer:

 

IF 
[% of Courses Completed]=0 THEN "No Classes Completed" ELSEIF 
[% of Courses Completed] <0.25 THEN "1% to 24% of Classes Completed" ELSEIF 
[% of Courses Completed] <0.50 THEN "25% to 49% of Classes Completed" ELSEIF 
[% of Courses Completed] <0.75 THEN "50% to 74% of Classes Completed" ELSEIF 
[% of Courses Completed] <1.00 THEN "75% to 99% of Classes Completed" 
ELSE "All Classes Completed"
ENDIF

When you use an IF and ELSEIF, you can shorten your code given you've already tried the values above your current value:

 

IF X <= 0 THEN "No classes" ELSEIF

X < 25 THEN "1 to 24%" ELSEIF

X < 50 THEN "25 to 50" ELSEIF......

 

You don't have to check the full range

X >= 0 AND X < 25 etcetera.

 

Thanks,

Mark

Alteryx ACE & Top Community Contributor

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