Alteryx Designer Desktop Discussions

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

Multiple Formula Calculation (IF ELSE)

scottjanse1
7 - Meteor

Hi,

 

Im new to Alteryx and I can't seem to be work out a formula. I am trying to give a ranking to certain outcomes from 1-0.1. I tried using seperate Multi-Field Formula with the calutions below:

 

IF [_CurrentField_]>27200 THEN 1.0 ELSE (IF [_CurrentField_]>20400 THEN 0.9  ELSE [_CurrentField_] ENDIF) ENDIF

IF [_CurrentField_]>13600 THEN 0.8 ELSE (IF [_CurrentField_]>6800 THEN 0.7  ELSE [_CurrentField_] ENDIF) ENDIF

IF [_CurrentField_]>0 THEN 0.6 ELSE (IF [_CurrentField_]>-6800 THEN 0.5  ELSE [_CurrentField_] ENDIF) ENDIF

IF [_CurrentField_]>-13600 THEN 0.4 ELSE (IF [_CurrentField_]>-20400 THEN 0.3  ELSE [_CurrentField_] ENDIF) ENDIF

IF [_CurrentField_]>-27200 THEN 0.2 ELSE (IF [_CurrentField_]>-100000 THEN 0.1  ELSE [_CurrentField_] ENDIF) ENDIF

 

It didn't give me the expected result as it calculates from the current field. I could change it, but I think there must be a way to comebine the calculation in one formula? Could anybody help me with this formula?

Thanks,

Scott

2 REPLIES 2
jdunkerley79
ACE Emeritus
ACE Emeritus

You can do this using the IF ... ELSEIF ... ENDIF syntax:

 

IF [_CurrentField_] > 27200 THEN 1.0 
ELSEIF [_CurrentField_] > 20400 THEN 0.9  
ELSEIF [_CurrentField_]>13600 THEN 0.8 
ELSEIF [_CurrentField_]>6800 THEN 0.7 
ELSEIF [_CurrentField_]>0 THEN 0.6
ELSEIF [_CurrentField_]>-6800 THEN 0.5  
ELSEIF [_CurrentField_]>-13600 THEN 0.4 
ELSEIF [_CurrentField_]>-20400 THEN 0.3  
ELSEIF [_CurrentField_]>-27200 THEN 0.2 
ELSEIF [_CurrentField_]>-100000 THEN 0.1  
ELSE [_CurrentField_] 
ENDIF

If you have only one field might be simple to use a standard formula tool. 

scottjanse1
7 - Meteor

Thank you so much! It works ;)

Labels