Alteryx Designer Desktop Discussions

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

Ranking columns per row (by field values)

Denikin
6 - Meteoroid

Let's assume I have a dataset in following structure:

IDEvent1_probabilityEvent2_probabilityEvent3_probabilityEvent4_probability
10.10.050.120.15
20.210.030.110.17

 

I want to add information about which event is:

- most probable

- 2nd most probable

etc.

Per each row.

Therefore, I would like to achieve the following structure:

IDEvent1_probabilityEvent2_probabilityEvent3_probabilityEvent4_probability1st_probability_event2nd_probability_event3rd_probability_event4th_probability_event
10.10.050.120.15Event4Event3Event1Event2
20.210.030.110.17Event1Event4Event3Event2

How to achieve it without writing enourmous IF statements for each new column?

Thanks in advance for any help!

 

3 REPLIES 3
derekbelyea
12 - Quasar

 

 

This should do it.

 

2018-02-11_00014.png

Denikin
6 - Meteoroid

Thanks, works great!

cliffjordan
8 - Asteroid

Denikin,

I have often run into the same scenario, so I created a Rank Macro called RankMacro.yxmc that you can use. You use it like any other Preparation Tool and just choose which fields you want to create ranks for. 

 

Here are the details:

"RankMacro is a standard macro that will rank fields within a record. The user chooses the fields he wants to Rank and the direction of the Rank (Descending or Ascending). The macro creates an additional field for each of the chosen rank fields to store the Rank value. These new fields will have the same name with a "_Rank" suffix."

 

 

cliffjordan_1-1578277285285.png

 

You can download this from the Gallery. Here is the link: 

https://gallery.alteryx.com/#!app/RankMacro/5e12839c8a933710f08216c2

 

Enjoy!

-cliff

 

Labels