Forum Discussion
Conditional Index
- 3 years ago
Hi Anonymous ,
According to your description, here's my solution.
Sample:
1.Add a new step in advanced editor.
= Table.Group(#"Changed Type", {"Column"}, {{"Index", each Table.AddIndexColumn(_, "Index", 1, 1, Int64.Type)}})2.Expand the new column with selecting the Index column.
Result:
Here's the whole M syntax:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnQ0M1SK1UFlmOJkmJshMWIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Column"}, {{"Index", each Table.AddIndexColumn(_, "Index", 1, 1, Int64.Type)}}), #"Expanded Index" = Table.ExpandTableColumn(#"Grouped Rows", "Index", {"Index"}, {"Index.Index"}) in #"Expanded Index"I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
According to your description, here's my solution.
Sample:
1.Add a new step in advanced editor.
= Table.Group(#"Changed Type", {"Column"}, {{"Index", each Table.AddIndexColumn(_, "Index", 1, 1, Int64.Type)}})
2.Expand the new column with selecting the Index column.
Result:
Here's the whole M syntax:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnQ0M1SK1UFlmOJkmJshMWIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Column"}, {{"Index", each Table.AddIndexColumn(_, "Index", 1, 1, Int64.Type)}}),
#"Expanded Index" = Table.ExpandTableColumn(#"Grouped Rows", "Index", {"Index"}, {"Index.Index"})
in
#"Expanded Index"
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I copy and paste your formula into advanced editor I get a "Token Equal Expected" error it appears after Table.Group but I cant figure out why? Am I also supposed to be changing the underscore after "Table.AddIndexColumn(__" ?
Thanks.