Forum Discussion
Sort columns contains weeks values
- 6 years ago
Hello Anonymous
try this. Add a column where you extract the first part, transform it to a date, sort it and then remove the date column
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Pc1LDsAgCEXRrRjHbeQTrazFuP9t+FqgI5LLCaxVSRrNcheamHVfKKORoTA25sXccE/DGsbS8HAjkkY0iv0F5nl/cRal+N6/O/sA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]), ChangeType = Table.TransformColumnTypes(Source,{{"Column1", type text}}), AddDateColumn = Table.AddColumn(ChangeType, "Custom", each Date.From(Text.Split([Column1]," - "){0})), SortDate = Table.Sort(AddDateColumn,{{"Custom", Order.Ascending}}), RemoveDate = Table.RemoveColumns(SortDate,{"Custom"}) in RemoveDateCopy 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
Hello Anonymous
try this. Add a column where you extract the first part, transform it to a date, sort it and then remove the date column
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Pc1LDsAgCEXRrRjHbeQTrazFuP9t+FqgI5LLCaxVSRrNcheamHVfKKORoTA25sXccE/DGsbS8HAjkkY0iv0F5nl/cRal+N6/O/sA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
ChangeType = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
AddDateColumn = Table.AddColumn(ChangeType, "Custom", each Date.From(Text.Split([Column1]," - "){0})),
SortDate = Table.Sort(AddDateColumn,{{"Custom", Order.Ascending}}),
RemoveDate = Table.RemoveColumns(SortDate,{"Custom"})
in
RemoveDate
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