raw |
|
Commas |
11 |
|
1,1 |
111111 |
|
1,1,1,1,1,1 |
1121 |
|
1,1,2,1 |
122 |
|
1,2,2 |
1111122 |
|
1,1,1,1,1,2,2 |
Code:
// Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Text = Table.TransformColumnTypes(Source,{{"raw", type text}}),
Index = Table.AddIndexColumn(Text, "Index", 1, 1),
SplitR = Table.ExpandListColumn(Table.TransformColumns(Index, {{"raw", Splitter.SplitTextByRepeatedLengths(1), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "raw"),
Grp = Table.Group(SplitR, {"Index"}, {{"Count", each _, type table}}),
List = Table.AddColumn(Grp, "Commas", each List.Buffer([Count][raw])),
Ext = Table.TransformColumns(List, {"Commas", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
TSC = Table.SelectColumns(Ext,{"Commas"})
in
TSC
Bookmarks