Power QueryExercises

DataFormat.Error: We couldn't convert to Logical

By Tahir Nas · Examples run in our simulator · Updated

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

Text was converted to true/false but isn't one of the values M understands. Logical.FromText accepts only "true" and "false" (any case), so Yes/No, Y/N or 1/0 fail.

Common causes

How to fix it

  1. Map values explicitly: if Text.Upper([Active]) = "YES" then true else false.
  2. Use a mapping table for many spellings.
  3. Keep the raw column and add a typed logical column, so unexpected values are visible.

Find the step that fails

Minimal example

Raises the error:

Logical.FromText("Yes")

Fixed:

Text.Upper("Yes") = "YES"

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

Related lessons

Similar errors