sandy666
07-12-2023, 03:18 AM
rawCommas
111,1
1111111,1,1,1,1,1
11211,1,2,1
1221,2,2
11111221,1,1,1,1,2,2
// 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(Inde x, {{"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
111,1
1111111,1,1,1,1,1
11211,1,2,1
1221,2,2
11111221,1,1,1,1,2,2
// 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(Inde x, {{"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