Get min row column name

Teja_Varanasi
Teja_Varanasi New Altair Community Member
edited November 5 in Community Q&A
I have a table like this

A B C D
5 2 1 9

I should get C in the results tab. Is there any operator to do this? Can somebody please help.

Best Answer

  • BalazsBarany
    BalazsBarany New Altair Community Member
    Answer ✓
    Hi! 

    You could transpose your table so that the values are in rows, not columns. Then sort by the number column and Filter Example Range for getting the first (lowest) value. The former attribute name in the second column will be the one associated with the lowest number.

    That's another way to do it. If you have multiple data rows (or expect to have them in the future), it might be better to use Loop Attributes.
    There you would use Aggregate to get the minimum of the current attribute and Generate Macro to compare the current value to the lowest known value and remember the attribute belonging to that. This is a bit more complicated than the first approach.

    Regards,
    Balázs

Answers

  • BalazsBarany
    BalazsBarany New Altair Community Member
    Answer ✓
    Hi! 

    You could transpose your table so that the values are in rows, not columns. Then sort by the number column and Filter Example Range for getting the first (lowest) value. The former attribute name in the second column will be the one associated with the lowest number.

    That's another way to do it. If you have multiple data rows (or expect to have them in the future), it might be better to use Loop Attributes.
    There you would use Aggregate to get the minimum of the current attribute and Generate Macro to compare the current value to the lowest known value and remember the attribute belonging to that. This is a bit more complicated than the first approach.

    Regards,
    Balázs
  • Teja_Varanasi
    Teja_Varanasi New Altair Community Member
    Thank You, it helped