Power QueryExercises

Expression.Error: The field of the record wasn't found

By Tahir Nas · Examples run in our simulator · Updated

Expression.Error: The field 'Amount' of the record wasn't found.

Code reads a field from a record that doesn't have it. In a custom column, [Amount] reads a field of the current row, so the error means the row has no column called Amount at that point.

Common causes

How to fix it

  1. Check the exact column names in the step before the custom column.
  2. Use the optional field access [Amount]? to get null instead of an error.
  3. Use Record.FieldOrDefault(_, "Amount", 0) when the field is genuinely optional.

Find the step that fails

Minimal example

Raises the error:

[Region = "North", Qty = 2][Amount]

Fixed:

[Region = "North", Qty = 2][Amount]?

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

Practise avoiding it

Related lessons

Similar errors