Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Rank with multi row formula tool

mphillips27
7 - Meteor

I have a column I would like to rank -- if the values are the same I would like them to be the same rank

 I am using a multi row formula tool:

if [recordables] != [Row-1:recordables] then [Row-1:recordables rank] + 1 else [ROW-1:recordables rank] endif

 

My issue is that is that the tool is not accounting for zero. -- if the recordables are zero I would like the rank to start at 1, but the tool starts it at zero.

 

RecordablesRankDesired rank
001
001

1

12

1

12

2

23

 

 

3 REPLIES 3
Luke_C
17 - Castor

Hi @mphillips27 


Here's two options:

  1. Multirow formula option
    1. if isnull([Row-1:Recordables]) then 1 elseif [Recordables]=[Row-1:Recordables] then [Row-1:Rank] else [Row-1:Rank]+1 endif
  2. Tile tool based on unique recordables

Luke_C_0-1630443972307.png

 

Maskell_Rascal
13 - Pulsar

Hi @mphillips27 

 

You were really close on your formula, but just need to add in one more variable to get the first rows to start at a rank of 1. When you are referencing the negative row of a numerical field, Alteryx identifies the value as zero. So in your case, [recordables] != [Row-1:recordables] is false because its reading it as 0=0. 

 

This formula should work for you instead. 

IF [Row-1:recordables rank]=0 THEN 1 
ELSEIF [recordables]!=[Row-1:recordables]
THEN [Row-1:recordables rank]+1
ELSE [Row-1:recordables rank] 
ENDIF

 

Cheers!

Phil

mphillips27
7 - Meteor

Both worked, thank you!

Labels