Power QueryExercises

Expression.Error: The field already exists in the record

By Tahir Nas · Examples run in our simulator · Updated

Expression.Error: The field 'Total' already exists in the record.

A step tried to create a column whose name is already taken: Add Column, Rename, Expand or Promote Headers produced a duplicate name.

Common causes

How to fix it

  1. Pick a new name, or remove the old column first.
  2. When expanding, use the new column names argument or keep the default prefix.
  3. Rename both columns in one Table.RenameColumns call when swapping names.

Find the step that fails

Minimal example

Raises the error:

Table.AddColumn(#table({"Qty", "Total"}, {{2, 10}}), "Total", each [Qty] * 5)

Fixed:

Table.AddColumn(#table({"Qty", "Total"}, {{2, 10}}), "Total check", each [Qty] * 5)

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