你在自定义函数里添加列展开了一次,最后面又添加列展开了一次,当然有重复了。
帮你改了一下:
let
fx=(bin)=>
let
表= Excel.Workbook(bin){0}[Data],
转为列表 = Table.ToColumns(表),
标题 = List.Transform(List.Zip({{0,3,0,3,0,2,4,0,2,4,0,3,0,3,0,1,2,4,5,0,1,2,4,5,0,3,0},{2,2,3,3,4,4,4,5,5,5,6,6,7,7,9,9,9,9,9,19,19,19,19,19,26,26,27}}),each 转为列表{_{0}}{_{1}}),
数据 = List.Transform(List.Zip({{1,3,1,3,1,3,5,1,3,5,1,4,1,4,0,1,2,4,5,0,1,2,4,5,1,4,2},{2,2,3,3,4,4,4,5,5,5,6,6,7,7,10,10,10,10,10,20,20,20,20,20,26,26,27}}),each {转为列表{_{0}}{_{1}}}),
结果 = Table.FromColumns(数据,标题)
in
结果,
Source = Folder.Files("C:\Users\Jeremy Fu\Desktop\PowerQuery\多维转一维\多维转一维\多文件汇总\源数据"),
#"Added Custom" = Table.AddColumn(Source, "a", each fx([Content])),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Name", "a"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "a", Table.ColumnNames(#"Removed Other Columns"[a]{0}))
in
#"Expanded Custom"