- let
- 源 = Excel.CurrentWorkbook(){[Name="表3"]}[Content],
- 分组的行 = Table.Group(源, {"列7"}, {"计数", each _},0,(x,y)=>try if Text.Contains( y[列7],"NO: ") then 1 else 0 otherwise 0),
- 筛选的行 = Table.SelectRows(分组的行, each ([列7] <> null)),
- 已添加自定义1 = Table.AddColumn(筛选的行, "自定义", (x) =>
- let
- 单号= x[计数][列7]{0},
- 日期= x[计数][列7]{2},
- 客户= List.Skip( Text.SplitAny(x[计数][列1]{2},":")){0},
- 计数2=Table.AddColumn(x[计数],"单号",each 单号),
- 计数3=Table.AddColumn(计数2,"日期",each 日期),
- 计数4=Table.AddColumn(计数3,"客户",each 客户),
- 删除的列 = Table.RemoveColumns(计数4,{"列9", "列10"}),
- 重命名的列 = Table.RenameColumns(删除的列,{{"列1", "订单号码"}, {"列2", "品名及规格"}, {"列3", "颜色"}, {"列4", "单位"}, {"列5", "数量"}, {"列6", "件数"}, {"列7", "净重(kg)"}, {"列8", "备注"}}),
- 自定义1 = Table.Skip( 重命名的列,3),
- 筛选的行1 = Table.SelectRows(自定义1, each ([数量] <> null))
- in
- 筛选的行1
- ),
- 删除的其他列 = Table.SelectColumns(已添加自定义1,{"自定义"}),
- #"展开的“自定义”" = Table.ExpandTableColumn(删除的其他列, "自定义", {"订单号码", "品名及规格", "颜色", "单位", "数量", "件数", "净重(kg)", "备注", "单号", "日期", "客户"}),
- 筛选的行1 = Table.SelectRows(#"展开的“自定义”", each ([订单号码] <> "订单号码")),
- 更改的类型 = Table.TransformColumnTypes(筛选的行1,{{"日期", type date}})
- in
- 更改的类型
复制代码 |