Hello!
I have two column OM and Quartile in percentages, (both columns are in V_W string in Alteryx).
I applied this formula in Alteryx, If OM>Quartile then "Above" else if OM<Quartile then "Below" else "Within" endif
But in the output, the results seem to be different. Attached the sample result. Please help me with this.
Solved! Go to Solution.
If they are V_WString then the comparison will an alpha comparison rather than a numeric check
Either change the type of the column using a select tool or use
If ToNumber(OM)>ToNumber(Quartile) THEN "Above" ELSE if ToNumber(OM)<ToNumber(Quartile) then "Below" else "Within" endif
If the % is in the text value you might need to remove it before ToNumber: e.g. ToNumber(Replace(OM,"%",""))
Thanks @jdunkerley79 for the quick response. I am getting error while using the formula.
Below is the error message.
If ToNumber(Replace(OM,"%",""))>ToNumber(Replace(Quartile,"%","")) THEN "Above" ELSEif ToNumber(Replace(OM,"%",""))<ToNumber(Replace(Quartile,"%","")) then "Below" else "Within" endif
There was an extra space between ELSE and IF