Forum Discussion

technicneo's avatar
technicneo
Frequent Visitor
2 years ago
Solved

Reformat text to sort

Hi Community, my problem is the following: My row "KW" (data type text) has to be sorted in asc order. However when the year changes (2024->2025) the order screws up (orange marked). I have found ...
  • AlienSx's avatar
    2 years ago
        Table.Sort(
            your_table,
            (x, y) => Value.Compare(
                Text.BeforeDelimiter(x[KW], "/") & Text.PadStart(Text.AfterDelimiter(x[KW], "/"), 2, "0"),
                Text.BeforeDelimiter(y[KW], "/") & Text.PadStart(Text.AfterDelimiter(y[KW], "/"), 2, "0")
            )
        )