方法一:
let 源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content], 更改的类型 = Table.TransformColumnTypes(源,{{"name", type text}, {"name_v", Int64.Type}}), n1 = Table.AddColumn(更改的类型,"c1",each List.Sum(Table.SelectRows(更改的类型, (x)=>x[name_v]<=_[name_v])[name_v])) in n1
解析:由内到外
Table.SelectRows(更改的类型,(x)=>x[name_v]<=_[name_v])[name_v]
Table.SelectRows(更改的类型,(x)=>x[name_v]<=_[name_v]) 返回的是一行 包含name ,name_v 两列
(x)=>x[name_v]<=_[name_v] #定义一个函数(),参数是x ( 包含name ,name_v 两列), 函数计算方式:x[name_v]<=_[name_v]
_[name_v] ### 对每一行的列name_v 都递归重复一遍
List.Sum()
Table.SelectRows(更改的类型,(x)=>x[name_v]<=_[name_v])[name_v]
方法二:
let 源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content], 更改的类型 = Table.TransformColumnTypes(源,{{"name", type text}, {"name_v", Int64.Type}}), n1 = Table.AddColumn(更改的类型,"c1",each Table.SelectRows(更改的类型, (x)=>x[name_v]<=_[name_v])), #"聚合的 c1" = Table.AggregateTableColumn(n1, "c1", {{"name_v", List.Sum, "c1.name_v 的总和"}}) in #"聚合的 c1"