Forum Discussion

Dunkhan's avatar
Dunkhan
New Member
4 years ago
Solved

Sort number as text from a list

Hi, I'm trying to sort number separated by comma in descending order in a list. I have a column of 3 number in text format, each separated by a comma I would like to sort each numbers in...
  • Jakinta's avatar
    4 years ago

    Or maybe you want this...

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtWx0DFSitUBsYx1LMEsQx1TqJghUMwQzLLQMdAxhDENjXQMDZRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        #"Added Custom" = Table.AddColumn(Source, "ListOfNumbers", each List.Sort( List.Transform(Text.Split([Column1],","), Number.From) , Order.Descending)),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "BackToText", each Text.Combine(List.Transform( [ListOfNumbers], Text.From) ,",")) // This Step can be merged in single step with the previous one.
    in
        #"Added Custom1"