let
源 = Table.Skip(Excel.CurrentWorkbook()),
清洗合并 = Table.RenameColumns(Table.Combine(List.Transform(源[Content],each [a=List.FirstN(_[Column1],2)&List.LastN(Record.ToList(_{2}),2),b=Table.SelectColumns(Table.CombineColumns(Table.FillDown(Table.SelectRows(Table.Skip(_,5),each [Column4]<>null),{"Column1"}),{"Column1","Column2"},each Text.Combine(List.Transform(_,Text.From),"_"),"项目"),{"项目","Column4"}),c=Table.SplitColumn(Table.AddColumn(b,"Column5",each a),"Column5",each _,{"项目编号","日期","姓名","ID"})][c])),{"Column4","金额"}),
透视 = Table.Pivot(清洗合并,List.Distinct(清洗合并[项目]),"项目","金额")
in
透视
|