Power QueryExercises

Expression.Error: We cannot convert the value to type Function

By Tahir Nas · Examples run in our simulator · Updated

Expression.Error: We cannot convert the value 1 to type Function.

Something that isn't a function was called with (), or passed where a function is expected. Common when a parameter has the same name as a function, or each was left out of a transform.

Common causes

How to fix it

  1. Only call names that hold functions; check the step that defines the name.
  2. Wrap transforms in each: {"Qty", each _ * 2}.
  3. Rename parameters so they don't shadow functions.

Find the step that fails

Minimal example

Raises the error:

let Rate = 1.2 in Rate(100)

Fixed:

let Rate = (amount as number) => amount * 1.2 in Rate(100)

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