Power QueryExercises

Expression.Error: We cannot apply field access to the type

By Tahir Nas · Examples run in our simulator · Updated

Expression.Error: We cannot apply field access to the type Number.

[Name] syntax only works on a record (such as a table row). This error means the value in front of it is a number, text or list, typically inside List.Transform where _ is the list item, not a row.

Common causes

How to fix it

  1. Inside list functions, use _ for the item itself: List.Transform(list, each _ * 2).
  2. Work on the table with Table.AddColumn or Table.TransformColumns, where each receives a row or a cell.
  3. Check the value's type first: if _ is record then _[Field] else null.

Find the step that fails

Minimal example

Raises the error:

List.Transform({1, 2, 3}, each [Qty] * 2)

Fixed:

List.Transform({1, 2, 3}, each _ * 2)

Both snippets are run by the Power Query Exercises simulator on every build: the first must raise Expression.Error, the second must run.

Related lessons

Similar errors