You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power Query创建分组汇总表报错:无法对数值类型应用字段访问

Power Query 汇总字段报错(can't apply field access to type number)解决方法

错误原因

你写的M代码里,List.Select([Value], each [Versions] = "Actuals") 存在逻辑问题:[Value] 是分组后单个列的数值列表,每个元素是纯数字,根本没有 [Versions] 字段,所以会触发"无法对数值类型应用字段访问"的错误。

修正后的M代码

let 
    Source = #"Portfolio Reporting",
    #"Grouped Rows" = Table.Group(Source, {"Project", "Expense Type", "Date"}, {
        {"Actuals", each List.Sum(Table.SelectRows(_, (row) => row[Versions] = "Actuals")[Value]), type nullable number},
        {"Current Budget", each List.Sum(Table.SelectRows(_, (row) => row[Versions] = "Current Budget")[Value]), type nullable number},
        {"Current Forecast", each List.Sum(Table.SelectRows(_, (row) => row[Versions] = "Current Fcst")[Value]), type nullable number}
    })
in
    #"Grouped Rows"

修改说明

  • 用 Table.SelectRows(_, ...) 替代原来的 List.Select([Value], ...),其中 _ 代表当前分组的所有行记录,这样就能正确读取每行的 Versions 字段进行筛选。
  • 筛选完成后提取 Value 列,再用 List.Sum 求和,符合需求逻辑。

内容的提问来源于stack exchange,提问作者Rachel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 08:12:53