繁体   English   中英

如何在电量查询中使用公式 - excel

[英]How to use formula in power query - excel

我在 excel 列“ J2 ”中使用了公式=IF($A1<>$A2,COUNTIF(A:A,$A2),"") 工作表中有n行。 我想将此公式应用于所有行。 在 excel 中,我们通过拖放复制公式。

如何使用电源查询实现相同的目的。

目前我正在使用电源查询在 excel 中加载外部数据。

任何输入都会有所帮助..谢谢

假设数据是Table1 ,第一列排序并命名为Column1

Group 和 对于这两个操作,使用Count RowsAll Rows

扩张

添加索引

使用索引来引用前一行

如果当前行的 Column1 = 前行的 Column1 则 null 否则计数

删除多余的列

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Grouped Rows" = Table.Group(Source, {"Column1"}, {{"Count", each Table.RowCount(_), type number}, {"Data", each _, type table}}),
#"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Column1"}, {"Column1.1"}),
#"Added Index" = Table.AddIndexColumn(#"Expanded Data", "Index", 0, 1),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if [Index]=0 then [Count] else if #"Added Index"{[Index]} [Column1] = #"Added Index"{[Index]-1} [Column1] then null else [Count]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1.1", "Index"})
in #"Removed Columns"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM