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

Adding Ranking column to a dataset

HA
8 - Asteroid

Hi,

 

I need to create a functionality similar to SQL RANK and only pick records with RANK=1

 

Following table is just an example of what I'm trying to do. In key field I have "AAA" repeated three times. Starting from the first record in the data set (order matters ) I need to assign rank 1,2,3,etc to each record.

The goal is to decide which records to keep and which ones to ignore when there are duplicate keys (the first incident is the valid record all others should be ignored)

 

KeyRank
AAA1
BBB1
CC1
AAA2
AAA3
BBB2
DDD1
EEE1

 

After assigning RANK to each record then I will pick only those records with RANK=1

 

KeyRank
AAA1
BBB1
CC1
DDD1
EEE1
7 REPLIES 7
gc
9 - Comet

I think this workflow and batch macro should do it. Check it out and let me know.

Gene

SeanAdams
17 - Castor
17 - Castor

Depending on your exact need, there may be another way to do this (but it's worth working through @gc 's solution - macros are probably the most powerful part of Alteryx)

 

 

And you're done.

 

Let me know if this or @gc 's gets you to a solution, or if not, then feel free to reply and we can work this through in a mockup.

 

cheers

Sean

SeanAdams
17 - Castor
17 - Castor

Hey @HA,

 

Did you manage to get a solution that worked from the 2 contributions that worked?   If not, feel free to reply and we can work this through together.

 

Have a good Tuesday

Sean

vishwa_0308
11 - Bolide

rank.JPG

HA
8 - Asteroid

Thank you. This is a log file and the order of records is important so although other suggestions are interesting I cannot user sorting tool because it will reorder the records.

I think just the grouping will work assuming Alteryx has a deterministic behavior when grouping records and always picks the first record in the group which basically what I'm looking for here  

Rich_Stebles
8 - Asteroid

Thank you vishwa_0308, this solution worked well for me

redruby
6 - Meteoroid

Thank you @SeanAdams , 

 

This helped me. 

Labels