community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

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

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

Alteryx Partner

This should do it,

 

cheers

Alteryx Certified Partner

Hi @GraceK ,

 

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!

Alteryx Certified Partner

Beat me to it :-)

Alteryx Partner

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

 

:)

Highlighted
ACE Emeritus
ACE Emeritus

Hi @GraceK,

 

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