Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Assign Rank

jaiiracha
7 - Meteor

Hello - I'm trying to assign a rank to the below sample dataset. What I would like to accomplish here is adding a single rank value to every row that starts with "312" in COL_1 and assign that same rank value to the rows that follow until we hit another "312" in COL_1. Then the rank value should change to the next value in the rank i.e "2". I've also attached what the desired output should looks like for reference. 

 

COL_1COL_2
312901029
ABasdd
3124901233
ABfasd
312120921
ABtro
BCdfds
ABdef
3124214111
BCar
EFdms

 

Desired Output:

 

COL_1COL_2Rank
3129010291
ABasdd1
31249012332
ABfasd2
3121209214
ABtro4
BCdfds4
ABdef4
31242141115
BCar5
EFdms5

 

Thank you!

7 REPLIES 7
ShankerV
17 - Castor

Hi @jaiiracha 

 

Yes, it is possible with the help of Multi row formula tool.

 

Shanker V

IraWatt
17 - Castor
17 - Castor

Hey @jaiiracha,

I think what you are looking for is the multi row formula to check the results on multiple rows:

IraWatt_0-1668534731759.png

This formula checks if the value is 312 if it is then add one to the rank row above.

 

If you want to learn more about the Multi-Row-Formula Tool the community has some quick and easy videos on the topic here: https://community.alteryx.com/t5/Interactive-Lessons/Multi-Row-Formula/ta-p/82872

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

Felipe_Ribeir0
16 - Nebula

Hi @jaiiracha 

 

One way of doing this

 

Felipe_Ribeir0_0-1668534831349.png

 

ShankerV
17 - Castor

Hi @jaiiracha 

 

Solution from my end

 

ShankerV_0-1668534878302.png

 

 

Shanker V

ShankerV
17 - Castor

@jaiiracha 

 

Breaking my solution for your convenience.

 

The multi row formula tool, helps to create a new row and input the values in each row based on the condition satisfied.

 

if ([COL_1]="312")
then [Row-1:Rank]+1
else [Row-1:Rank]
endif

 

If the condition is met, then it increases the rank + 1

else it inputs the same previous rank.

 

This way it helps to reach your expected output.

 

Kindly accept this solution if it provided a solution to your question.

 

ShankerV_0-1668535183311.png

 

Many thanks

Shanker V

jaiiracha
7 - Meteor

Thank you all! All great solutions and get the job done!

IraWatt
17 - Castor
17 - Castor

Great to hear @jaiiracha have a good one !

Labels