发现一个问题,竟然找不到列1,然后改了一下
let
源= Excel.CurrentWorkbook(){[Name="表1"]}[Content],
提取的年=Table.TransformColumns(源,{{"日期",Date.WeekOfYear,Int64.Type}}),
自定义1 = Table.Group(提取的年,"日期" ,{"n",each Text.Combine(_[内容])}),
自定义2 = Table.TransformColumns(自定义1,{"n" ,each [a=List.Transform({"能","否", "打开"}, (x)=>List.Count(Text.PositionOf(_,x,2))),
b=Table.PromoteHeaders(Table.FromColumns(List.Zip({{"能","否","打开"},a})))]}),
qq=Table.ExpandTableColumn(自定义2, "n", {"能","否","打开"}, {"能","否","打开"}),
自定义3=Table.AddColumn(qq,"能累计",each List.Sum(List.FirstN(qq[能],_[日期]))),
自定义4=Table.AddColumn(自定义3,"否累计",each List.Sum(List.FirstN(qq[否],_[日期]))),
自定义5=Table.AddColumn(自定义4,"打开累计",each List.Sum(List.FirstN(qq[打开],_[日期]))),
重排序的列=Table.ReorderColumns(自定义5,{"日期","能","能累计","否","否累计","打开","打开累计"}),
重命名的列=Table.RenameColumns(重排序的列,{{"日期","周"}}),
重排序的列1=Table.ReorderColumns(重命名的列,{"周","否","否累计","能","能累计","打开","打开累计"})
in
重排序的列1 |