Expression.Error: The name '_' wasn't recognized (missing each)
By Tahir Nas · Examples run in our simulator · Updated
Expression.Error: The name '_' wasn't recognized. Make sure it's spelled correctly.
[Column] is shorthand for _[Column], and _ only exists inside each (or a function with a parameter called _). Writing a condition like [Qty] > 0 without each makes M look for _ and fail.
Common causes
- Table.SelectRows(Source, [Qty] > 0) without each.
- Table.AddColumn(Source, "Total", [Qty] * [Price]) without each.
- Copying a condition out of an if into another step.
How to fix it
- Add each: Table.SelectRows(Source, each [Qty] > 0).
- Or write the function in full: (row) => row[Qty] > 0.
- Remember that functions which take a row or a value always need each or => .
Find the step that fails
- Open the query in the Power Query editor (Excel: Data → Queries & Connections → Edit; Power BI Desktop: Transform data).
- Click the steps in Applied Steps from the top. The first step that shows the error is where it starts; later steps only repeat it.
- Read that step's formula in the formula bar (View → Formula Bar if it's hidden) and compare it with the columns and values the previous step produced.
Minimal example
Raises the error:
Table.SelectRows(#table({"Qty"}, {{1}}), [Qty] > 0)Fixed:
Table.SelectRows(#table({"Qty"}, {{1}}), each [Qty] > 0)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
- beginner~5 minFree
Keep only completed orders (kite shop)
Filter out cancelled and pending orders so only completed sales remain.
- beginner~7 minFree
Find bulk orders in a price band (kite shop)
Keep orders of at least 4 units priced under 20, ignoring rows with no quantity.
- intermediate~7 minFree
Keep orders for a list of products (kite shop)
Keep only orders whose Product is in the promotion list held in a separate PromoProducts table.
- beginner~6 minFree
Find stock held in warehouse B and running low (hardware)
Keep rows in warehouse WH-B where OnHand is below the reorder level.
Related lessons
- Row context: whole-table values and the previous row
- Write and use custom functions
- Filter rows by value