新列中所需的注释基于电源查询中其他列的条件[已关闭]

问题描述 投票:0回答:1

在这张表中,我需要找出哪些发票材料批次是按顺序使用的,哪些不是按顺序使用的。

我需要结果是

库存编号 日期 库存计数 产品代码 批次 批次 序列号 需要带有注释的新列 9573334429 31/07/2023 1 57663 TAP3F20026 4 未追踪 9573334430 31/07/2023 1 68691 UIWZ306057 1 未追踪 9573334431 31/07/2023 0 57822 MKL3D20031 1 未追踪 9573334431 31/07/2023 0 69422 MKL3D20028 1 串行 9573334431 31/07/2023 1 69422 MKL3D20032 2 串行 9573334431 31/07/2023 0 69469 MKL3F20039 1 未追踪 9573334432 31/07/2023 1 67671 SPR3B20026 5 未追踪 9573334433 31/07/2023 1 59175 SPR3B20064 2 未追踪 9573334434 31/07/2023 1 70963 MKL3B23039 3 未追踪 9573334435 31/07/2023 1 70963 MKL3B23038 2 未追踪 9573334436 31/07/2023 1 68691 UIWZ306057 1 未追踪 9573334437 31/07/2023 1 57663 TAP3F20026 4 未追踪 9573334437 31/07/2023 0 69012 TAP3F20025 4 未追踪 9573334438 31/07/2023 1 55710 TAP2F20043 3 未追踪 9573334438 31/07/2023 0 55714 TAP3A20011 3 未追踪 9573334439 31/07/2023 1 66966 HAP2F20114 2 串行 9573334439 31/07/2023 0 66966 HAP2F20115 3 串行

comments sequence powerquery group
1个回答
0
投票

以后需要提供更清晰的数据和解释。

但是,这可以在 PowerQuery 中实现您想要的功能:按库存编号和产品代码分组。如果有一行,则“未追踪”。如果有多行 Batch Serials 是连续的,则为“Serial”,否则为“Non Serial”

let  Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Grouped Rows" = Table.Group(Source, {"Inv No", "Product Code"}, {{"data", each
      let count = Table.RowCount(_),
      difference=List.Difference({List.Min(_[Batch Serial])..List.Max(_[Batch Serial])},_[Batch Serial]),
      process=Table.AddColumn(_, "check", each try if count=1 then "Not Traced" else if List.Count(difference)=0 then "Serial" else "Non Serial" otherwise "Non Serial")
in process, type table}}),
#"Expanded data" = Table.ExpandTableColumn(#"Grouped Rows", "data", {"Date", "Inv Count", "Batch", "Batch Serial", "Required New Column with Comments", "check"}, {"Date", "Inv Count", "Batch", "Batch Serial",    "Required New Column with Comments", "check"})
in  #"Expanded data"   

© www.soinside.com 2019 - 2024. All rights reserved.