|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 127000 于 2024-7-26 22:48 编辑
let
Source = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
SplitQty = Table.AddColumn(Source, "AllData", each List.Transform({1..[Qty]}, (x)=> Text.From(([ID])) & "," & [StoreName] & "," & Text.From([Size]))),
GetAllData = Table.SelectColumns(SplitQty,{"AllData"}),
ExpandAllData = Table.ExpandListColumn(GetAllData, "AllData"),
SplitAllData = Table.SplitColumn(ExpandAllData, "AllData", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"ID", "StoreName", "Size"}),
GroupData = Table.Group(SplitAllData, "StoreName", {"GP", each Table.AddIndexColumn(_, "Index",0,1) }),
GetGP = Table.SelectColumns(GroupData,{"GP"}),
ExpandAll = Table.ExpandTableColumn(GetGP, "GP", {"ID", "StoreName", "Size", "Index"}),
SetBarCode = Table.AddColumn(ExpandAll, "BarCode", each _[StoreName] & Number.ToText(Number.IntegerDivide(_[Index],6) +1, "0000") ),
DeleteIndex = Table.RemoveColumns(SetBarCode,{"Index"})
in
DeleteIndex
|
|