ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

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

>= operator not working

cbabel14
6 - Meteoroid

Hey all,

 

I got an issue on this function as the IF function keep popping out invalid ">=" Operator function. The error occurs right after the Bolded formula as the rest of the code is not recognized to completed the IF function

 

Anyone knows why would it happen?

 

 

IF
[Final Firm Category]="F" && [Sum_AUM_USD in MM]>=5 OR [Sum_Funds raised last 10 years]>=5
THEN "E"

ELSEIF
[Sum_AUM_USD in MM]>=4 OR [Sum_Funds raised last 10 years]>=4 &&[Final Firm Category]="I"
THEN "E"
ELSE "C"
ENDIF

AngelosPachis
15 - Aurora

Hi @cbabel14 ,

 

Can you please provide us with a screenshot of the data types for the fields used in the expression?

 

So

 

[Final Firm Category], [Sum_AUM_USD in MM] and [Sum_Funds raised last 10 years]

 

Thanks,

 

Angelos

cbabel14
6 - Meteoroid

Hey AngelosPachis

 

Sum_AUM_USD in MMV_WSTRING
Final Firm CategoryV_WSTRING
Sum_Funds raised last 10 yearsV_WSTRING
AngelosPachis
15 - Aurora

Hey @cbabel14 ,

 

Thanks for sharing that extra detail.

 

As you can see for your own, all those fields are of String data types, but >= is a numerical operator. So Alteryx cannot find which values are greater than 5 because it treats all of them as text (for example you can tell if fg<=ed)

 

There are two ways you can solve this: 

 

  1. Stick a select tool before your formula tool and change the data type for [Sum_AUM_USD in MM] and [Sum_Funds raised last 10 years] from V_String to a numeric data type (Int 64 if the values are integers or Double if they have decimals)
  2. You can temporarily convert a column to a certain data type for your expression to work by using the Tonumber function. Your expression will then be

 

IF
[Final Firm Category]="F" && Tonumber([Sum_AUM_USD in MM])>=5 OR Tonumber([Sum_Funds raised last 10 years])>=5
THEN "E"

ELSEIF
Tonumber([Sum_AUM_USD in MM])>=4 OR Tonumber([Sum_Funds raised last 10 years])>=4 &&[Final Firm Category]="I"
THEN "E"
ELSE "C"
ENDIF

 

 

It's best practice to have the correct data type for your columns, so if it contains data that you want to use for certain expression that column should be of numeric data type, so I suggest you go down route no.1, but either would work.

 

Let me know if that worked for you.

 

Cheers,

 

Angelos

cbabel14
6 - Meteoroid

Hey Angelos,

 

It works! thanks alot! I will bear that in mind when it comes to choosing to correct data types

 

Cheers!

Labels