Power QueryExercises

Expression.SyntaxError: Token Comma expected

By Tahir Nas · Examples run in our simulator · Updated

Expression.SyntaxError: Token Comma expected.

The code isn't valid M, so nothing runs. Most often a comma is missing between two steps of a let, or between list or record items. The editor points at the token after the gap.

Common causes

How to fix it

  1. Every step except the last ends with a comma.
  2. Check the line just above the one the editor highlights.
  3. Format the query (one step per line) so a missing comma stands out.

Find the step that fails

Minimal example

Raises the error:

let Source = 1 Next = Source + 1 in Next

Fixed:

let Source = 1, Next = Source + 1 in Next

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

Practise avoiding it

Related lessons

Similar errors