Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Identify the max value in a row, and add a column that gives the column name of this max

GraceK_dup_114
7 - Meteor

Hi again, 

 

I have a table with an ID in first column and numbers in the rest of the columns. I would like to create another column "R_ID", where for each row, it would look for the biggest number of the row and put in my R_ID the name of the column that contained the biggest number of the row.

 

For example :

 

ID  colA colB colC     =>   R_ID

l1     34     -5    12              colA

l2      6      10     4              colB      

 

Do you have an idea about how to create such a "R_ID" colum? 

 

BR,

 

Grace

5 REPLIES 5
afv2688
16 - Nebula
16 - Nebula

This should do it,

 

cheers

jamielaird
14 - Magnetar

Hi @GraceK_dup_114 ,

 

Something like this would work. If you want to account for cases where multiple columns share the highest value you can use Summarize instead.

 

Cheers,

 

Jamie

 

-----

If I've answered your question please consider marking this solution as accepted. Thank you!

jamielaird
14 - Magnetar

Beat me to it :-)

afv2688
16 - Nebula
16 - Nebula

Both solutions work, but maybe yours is even prittier (like it more than mine for sure)

 

:)

JohnJPS
15 - Aurora

Hi @GraceK_dup_114,

 

I have a couple approaches in the attached solution.

  • One uses mulit-row formula, which is quick and easy if you have a small set of columns and can "hard code" a quick solution.
  • The other is more generic: if you transpose the data, your columns become rows, then use the Summarize tool to get the row-wise max value; then just join that back to the original dataset.

Hope that helps!

 

[edit: geez, I'm slow]

 

Labels