let
源 = Excel.Workbook(File.Contents("C:\Users\lenovo\Desktop\Book1.xlsx"), null, true),
筛选的行 = Table.SelectRows(源, each ([Item] <> "汇总")),
自定义1 = 筛选的行[Data],
自定义2 = List.Transform(自定义1,each [
a=Table.SelectColumns(Table.CombineColumns(Table.FillDown(Table.TransformColumnTypes(_,{{"Column2",type text}},"zh-CN" ),{"Column1"} ),{"Column2", "Column1"},Combiner.CombineTextByDelimiter(""),"合并"),{"合并","Column4","Column5"} ) ,
b=Table.FirstN(a,3) ,
c=List.Distinct(List.RemoveItems(Text.Split(Text.Combine(Table.ToList(b)),",") ,{""})),
d=Table.FromColumns({{"项目名称","日期","姓名","ID"},c},List.FirstN( Table.ColumnNames(a),2)),
e=d & Table.LastN(a, Table.RowCount(a)-3),
f=Table.SelectRows(e, each [Column4]<>null ),
g=Table.RemoveLastN( Table.PromoteHeaders(Table.Transpose(f))) ]
[g] ),
自定义3 = Table.Combine(自定义2)
in
自定义3 |