我想要电力查询的解决方案。
我有一列文档编号,但它是根据出售的材料而来的,因此,在Excel power查询中,我需要将第一行定义为1,其余行定义为0。
如果有人有解决办法,请跟我分享一下m函数/公式。
发布于 2021-02-13 19:08:21
右键单击Documentnumber列,选择Group ,使用所有默认选择
调整公式栏中的公式
= Table.Group(Source, {"Documentnumber"}, {{"Count", each Table.RowCount(_), type number}})至
= Table.Group(Source, {"Documentnumber"}, {{"Count", each Table.AddIndexColumn(_, "Index", 1, 1), type table}})使用新列上方的箭头展开索引列
添加列..。定制栏..。用公式
= If Index = 1 then 1 else 0删除索引列
档案..。关闭并装载..。
样本代码
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Grouped Rows" = Table.Group(Source, {"Documentnumber"}, {{"Count", each Table.AddIndexColumn(_, "Index", 1, 1), type table}}),
#"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Index"}, {"Index"}),
#"Added Custom" = Table.AddColumn(#"Expanded Count", "Custom", each if [Index]=1 then 1 else 0),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in #"Removed Columns"https://stackoverflow.com/questions/66188070
复制相似问题