Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Get Column Name Formula

Good afternoon Folks   I have 4 columns with different values and in the 5th column, I have a formula that pics the lowest value from the 4 columns.   I am looking for a formula/ideas that will a...
  • Jimmy801's avatar
    5 years ago

    Hello Anonymous 

     

    use this formula

    Table.Min(Record.ToTable(_), "Value")[Name]

    Here the full code

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("PY7BEQAhCAN74e1Hg6i1MPbfxhEY7xOZJKy4CyBNbIXoCekqt7msztlCJiM76RqNjBQ10cVmjQZI0CLEE+6kDEa7upwna7DCJJc1I3egtn7uOyoX8jJ9H+XCCu79AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", Int64.Type}, {"C", Int64.Type}, {"D", Int64.Type}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table.Min(Record.ToTable(_), "Value")[Name])
    in
        #"Added Custom"

    THis is the result

     

    Copy paste this code to the advanced editor in a new blank query to see how the solution works.

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy