Power QueryExercises

DataFormat.Error: We couldn't convert to Number

By Tahir Nas · Examples run in our simulator · Published · Updated

DataFormat.Error: We couldn't convert to Number.

Text that isn't a number was converted to a number type, such as "n/a", an empty string or a decimal comma read with the wrong culture.

Common causes

How to fix it

  1. Convert with the source culture: Table.TransformColumnTypes(…, "de-DE").
  2. Replace or remove errors after the type change.
  3. Use try Number.FromText(x) otherwise null in a custom column.

Find the step that fails

Minimal example

Raises the error:

Number.FromText("n/a")

Fixed:

try Number.FromText("n/a") otherwise null

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

Practise avoiding it

Guides

Related lessons

Similar errors