Alteryx Designer Desktop Discussions

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

Percentage Compariosn

Meoth
8 - Asteroid

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.

 

 

4 REPLIES 4
jdunkerley79
ACE Emeritus
ACE Emeritus

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,"%",""))

 

Meoth
8 - Asteroid

Thanks @jdunkerley79  for the quick response. I am getting error while using the formula.

 

Below is the error message.

 
 
 

Capture.JPG

jdunkerley79
ACE Emeritus
ACE Emeritus
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

 

 

Meoth
8 - Asteroid

Many Thanks @jdunkerley79 

 

It works!!

Labels