我有一个带有字段的 excel 表ProductCode
,ProductDescription
并且Sales
。我想添加一个名为“ Store
”的列,其中的值来自某些标题行,如下图所示。
谢谢!
原来的:
期望的结果:
我有一个带有字段的 excel 表ProductCode
,ProductDescription
并且Sales
。我想添加一个名为“ Store
”的列,其中的值来自某些标题行,如下图所示。
谢谢!
原来的:
期望的结果:
这将提取商店并将其放在另一列中
Test
在Source行中是表的名称
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
让我知道它是否有效