-3

我有一个带有字段的 excel 表ProductCodeProductDescription并且Sales。我想添加一个名为“ Store”的列,其中的值来自某些标题行,如下图所示。

谢谢!

原来的:

在此处输入图像描述

期望的结果:

在此处输入图像描述

示例文件

4

1 回答 1

1

这将提取商店并将其放在另一列中

TestSource行中是表的名称

let
    Source = Excel.CurrentWorkbook(){[Name="Test"]}[Content],
    ChangeTypes = Table.TransformColumnTypes(Source,{{"ProductCode", type text}, {"ProductDescription", type text}, {"Sales", Int64.Type}}),
    AddStoreCol = Table.AddColumn(ChangeTypes, "Store", each if [ProductDescription] = null and Text.Start([ProductCode],5) <> "TOTAL" then [ProductCode] else null, type text),
    FillDown = Table.FillDown(AddStoreCol,{"Store"}),
    FilterNulls = Table.SelectRows(FillDown, each [ProductDescription] <> null and [ProductDescription] <> "")
in
    FilterNulls

让我知道它是否有效

于 2020-01-28T03:03:23.263 回答