Power QueryExercises

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

By Tahir Nas · Examples run in our simulator · Updated

Expression.Error: We cannot convert the value 1042 to type Text.

A text function such as Text.Start, Text.Length or Text.Combine received a number. M never converts numbers to text implicitly; you convert explicitly with Text.From.

Common causes

How to fix it

  1. Convert first: Text.Start(Text.From([Code]), 2).
  2. For Text.Combine, transform the list: Text.Combine(List.Transform(list, Text.From), ", ").
  3. Keep identifier columns (codes, ZIPs, IDs) as text from the start so leading zeros survive.

Find the step that fails

Minimal example

Raises the error:

Text.Start(1042, 2)

Fixed:

Text.Start(Text.From(1042), 2)

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