Forum Discussion
chanal
6 years agoHelper I
Transform Data : many occurences with the same code (a loop case?)
Hello, I would like to solve one problem I encounter when I have this file : https://bit.ly/2r7wVug I would like to transform in M those datas but there are some loop occurrences : Each time the...
- 6 years ago
chanal start a blank query and copy following code and you will get the result and take it from there
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjZU0lEK9vUM8VCK1QFyjYBcx5TEXAjPGMgzNDXUMzOH8E1AfB0TAwOFR01rIEIg/c4+jpEI7cGJSUWZeYn4TDCFmRALAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Code = _t, Values = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Code", type text}, {"Values", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Code"}, {{"Rank", each Table.AddIndexColumn(_, "Rank", 1)}}), #"Expanded Rank" = Table.ExpandTableColumn(#"Grouped Rows", "Rank", {"Values", "Rank"}, {"Values", "Rank.1"}), #"Pivoted Column" = Table.Pivot(#"Expanded Rank", List.Distinct(#"Expanded Rank"[Code]), "Code", "Values") in #"Pivoted Column"