Expression.Error: The name ‘Source’ wasn’t recognized. (Step-naming conflicts).

In Power Query, Expression.Error: The name 'Source' wasn't recognized means your M-code step references an identifier called Source that does not exist in the query environment. This happens when the initial extraction step was renamed, deleted, moved out of order, or referenced with mismatched letter casing.

Quick Answer

Open the Advanced Editor from the Home tab. Locate the step throwing the error and check its input argument. Change Source to the exact name of your preceding step (for example, #"Source Table" or #"Promoted Headers"). Step names in Power Query are strictly case-sensitive and must match earlier identifiers exactly.


Understanding the M-Code Step Dependency Chain

Power Query builds data transformations as an evaluation pipeline using the let ... in structure. Every transformation step is technically an assigned variable name holding the output of an M expression. Subsequent steps consume earlier steps by referencing their variable names as inputs:

let
    Source = Csv.Document(File.Contents("C:\Data\Sales.csv"), [Delimiter=","]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers", {{"Amount", Int64.Type}})
in
    #"Changed Type"

In the example above, #"Promoted Headers" takes Source as its first parameter, and #"Changed Type" takes #"Promoted Headers".

The error The name 'Source' wasn't recognized occurs whenever a step asks for an input named Source, but the query’s dependency chain cannot find that identifier anywhere above it in the let block.


Primary Causes and Diagnostic Steps

1. Casing Mismatches

Power Query’s M language is strictly case-sensitive. If your opening step is named source (lowercase) or SOURCE (uppercase), referencing Source in the next line triggers this error.

  • Fix: Check your opening assignment. If the first line reads:
    Then the downstream step must read:
    Alternatively, rename the original variable to standard title case: Source. source = Excel.Workbook(...) #"Promoted Headers" = Table.PromoteHeaders(source, ...)

2. The Step Was Renamed in the UI Without Updating Downstream References

When you right-click a step in the Applied Steps pane and rename it, for instance, changing Source to Raw File, Power Query typically auto-updates the immediate next step. However, if a later manual formula or custom step hardcoded Source, the link breaks:

  • Faulty Code: let #"Raw File" = Excel.CurrentWorkbook(){[Name="SalesTable"]}[Content], #"Filtered Rows" = Table.SelectRows(Source, each [Status] = "Active") in #"Filtered Rows"
  • Corrected Code: let #"Raw File" = Excel.CurrentWorkbook(){[Name="SalesTable"]}[Content], #"Filtered Rows" = Table.SelectRows(#"Raw File", each [Status] = "Active") in #"Filtered Rows"

3. Missing #" " Syntax for Names with Spaces

If a step name contains spaces, special characters, or starts with numbers, Power Query requires it to be wrapped in quotes preceded by a hash symbol: #"Step Name". If you rename Source to Source Data, writing Table.SelectRows(Source Data, ...) will fail with syntax errors or claim that Source was not recognized because it stops parsing at the space.

Ensure that all references to multi-word step names use the #"..." syntax:

#"Cleaned Data" = Table.Distinct(#"Source Data")

4. Step Reordering and Scoping Issues

Power Query reads dependencies sequentially. If you reordered steps in the Applied Steps list, or pasted M-code from another query, a step might attempt to call Source before Source is defined, or call a step that only exists in another query.

If your query relies on another query named Source, see “This query contains a reference to another query”: Handling dependency breaks to resolve inter-query link failures.


Step-by-Step Fix in the Advanced Editor

  1. Open Power Query, select the broken query in the left panel, and click Advanced Editor on the Home or View tab.
  2. Scan the lines between let and in.
  3. Locate the variable definition on the left side of the first = sign. That is your initial step identifier.
  4. Locate the step throwing the error. Identify where it calls Source.
  5. Replace Source with the exact variable name defined in the line above it, including any #" " wrapper.
  6. Click Done. The Applied Steps pane will recalculate and clear the error banner.

Verifying the Fix

Once the identifier matches, the formula bar error badge disappears, and the preview grid displays data for the selected step. If your query recalculates but fails on a column reference in the newly linked step, check Expression.Error: The column ‘Column1’ of the table wasn’t found to diagnose downstream column schema issues.