Expression.Error: A cyclic reference was encountered during evaluation
By Tahir Nas · Examples run in our simulator · Updated
Expression.Error: A cyclic reference was encountered during evaluation.
Two steps or queries depend on each other, directly or through a chain, so neither can be computed first.
Common causes
- A step that refers to a later step of the same query.
- Query A references Query B, which references Query A.
- A parameter query that reads from the table it filters.
How to fix it
- Make each step refer only to steps above it.
- Break query loops: move shared logic into a third query both can reference.
- Use Query Dependencies (View tab) to see the loop.
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:
let Total = Net + 1, Net = Total - 1 in TotalFixed:
let Net = 10, Total = Net + 1 in TotalBoth 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~8 minFree
Reorder steps so cleaning happens before grouping (kite shop)
The query groups regions before cleaning them, so " north" and "North" are counted separately. Fix the step order.
- intermediate~7 minFree
Fix a query that removes a column before using it (kite shop)
The query trims columns too early, so the Revenue step can't find UnitPrice. Reorder the steps.
- intermediate~7 minFree
Fix a step that silently skips the cleaning step (kite shop)
The query runs, but its totals are split across " north" and "North": the Group step reads Source instead of the cleaned step.
- beginner~7 minFree
Fix a query whose steps point at the wrong step (kite shop)
A step was renamed and the next step still refers to the old name. Repair the chain so the query runs.
Related lessons
- Reference other queries: staging and reuse
- Step order matters
- Applied steps are a recipe, not a one-off edit