我需要使用 PQ 复制多个列,是的,我可以手动执行 10 个步骤或 1 个纠缠步骤和 10 个复制列命令。
虽然我在添加我使用的列时遇到了类似的问题:
#"Added Custom" =
Table.AddColumn(#"Changed Type", "record", each [
Custom = "DTO",
#"Custom.1" = Date.ToText([Accounting Date],"YYYYMMDD"),
#"Custom.2" = "SA",
#"Custom.3" = "DTO " & Date.ToText([Accounting Date], "yyyy.MM"),
#"Custom.4" = null,
#"Custom.5" = null,
#"Custom.6" = null,
#"Custom.7" = null,
#"Custom.8" = null,
#"Custom.9" = if Text.StartsWith([General Ledger Code],"5") then [Cost Center] else null,
#"Custom.10" = null,
#"Custom.11" = null,
#"Custom.12" = null,
#"Custom.13" = if Text.StartsWith([General Ledger Code], "5") then "IF" else null
]),
#"Expanded record" = Table.ExpandRecordColumn(#"Added Custom", "record", {"Custom", "Custom.1", "Custom.2", "Custom.3", "Custom.4", "Custom.5", "Custom.6", "Custom.7", "Custom.8", "Custom.9", "Custom.10", "Custom.11", "Custom.12", "Custom.13"}, {"Custom", "Custom.1", "Custom.2", "Custom.3", "Custom.4", "Custom.5", "Custom.6", "Custom.7", "Custom.8", "Custom.9", "Custom.10", "Custom.11", "Custom.12", "Custom.13"}),
它适用于添加列
但是我在尝试复制它时失败了:
#"Duplicated test" = Table.AddColumn(#"Expanded record", "duplicated", each [
#"Custom.14" = Table.DuplicateColumn(#"Expanded record", "Custom.1", "Custom.1 - Copy"),
#"Custom.15" = Table.DuplicateColumn(#"Expanded record", "Custom.3", "Custom.3 - Copy")
]),
#"Expanded duplicated" = Table.ExpandRecordColumn(#"Duplicated test", "duplicated", {"Custom.14", "Custom.15"}, {"Custom.14", "Custom.15"}),
扩展列后,我收到了整个表,而不仅仅是 2 个额外的列。
有没有办法像添加列一样简化复制列?