One of the more confusing Power BI errors—especially for intermediate users—is:
“A circular dependency was detected”
This error typically appears when working with DAX measures, calculated columns, calculated tables, relationships, or Power Query transformations. While the message is short, the underlying causes can vary, and resolving it requires understanding how Power BI evaluates dependencies.
This article explains what the error means, common scenarios that cause it, and how to resolve each case.
What Does “Circular Dependency” Mean?
A circular dependency occurs when Power BI cannot determine the correct calculation order because:
- Object A depends on B
- Object B depends on A (directly or indirectly)
In other words, Power BI is stuck in a loop and cannot decide which calculation should be evaluated first.
Power BI uses a dependency graph behind the scenes to determine evaluation order. When that graph forms a cycle, this error is triggered.
Example of the Error Message
Below is what the error typically looks like in Power BI Desktop:
A circular dependency was detected:
Table[Calculated Column] → Measure[Total Sales] → Table[Calculated Column]
Power BI may list:
- Calculated columns
- Measures
- Tables
- Relationships involved in the loop
⚠️ The exact wording varies depending on whether the issue is in DAX, relationships, or Power Query.
Common Scenarios That Cause Circular Dependency Errors
1. Calculated Column Referencing a Measure That Uses the Same Column
Scenario
- A calculated column references a measure
- That measure aggregates or filters the same table containing the calculated column
Example
-- Calculated Column
Flag =
IF ( [Total Sales] > 1000, "High", "Low" )
-- Measure
Total Sales =
SUM ( Sales[SalesAmount] )
Why This Fails
- Calculated columns are evaluated row by row during data refresh
- Measures are evaluated at query time
- The measure depends on the column, and the column depends on the measure → loop
How to Fix
✅ Replace the measure with row-level logic
Flag =
IF ( Sales[SalesAmount] > 1000, "High", "Low" )
✅ Or convert the calculated column into a measure if aggregation is needed
2. Measures That Indirectly Reference Each Other
Scenario
Two or more measures reference each other through intermediate measures.
Example
Measure A = [Measure B] + 10
Measure B = [Measure A] * 2
Why This Fails
- Power BI cannot determine which measure to evaluate first
How to Fix
✅ Redesign logic so one measure is foundational
- Base calculations on columns or constants
- Avoid bi-directional measure dependencies
Best Practice
- Create base measures (e.g., Total Sales, Total Cost)
- Build higher-level measures on top of them
3. Calculated Tables Referencing Themselves (Directly or Indirectly)
Scenario
A calculated table references:
- Another calculated table
- Or a measure that references the original table
Example
SummaryTable =
SUMMARIZE (
SummaryTable,
Sales[Category],
"Total", SUM ( Sales[SalesAmount] )
)
Why This Fails
- The table depends on itself for creation
How to Fix
✅ Ensure calculated tables reference:
- Physical tables only
- Or previously created calculated tables that do not depend back on them
4. Bi-Directional Relationships Creating Dependency Loops
Scenario
- Multiple tables connected with Both (bi-directional) relationships
- Measures or columns rely on ambiguous filter paths
Why This Fails
- Power BI cannot determine a single filter direction
- Creates an implicit circular dependency
How to Fix
✅ Use single-direction relationships whenever possible
✅ Replace bi-directional filtering with:
USERELATIONSHIPTREATAS- Explicit DAX logic
Rule of Thumb
Bi-directional relationships should be the exception, not the default.
5. Calculated Columns Using LOOKUPVALUE or RELATED Incorrectly
Scenario
Calculated columns use LOOKUPVALUE or RELATED across tables that already depend on each other.
Why This Fails
- Cross-table column dependencies form a loop
How to Fix
✅ Move logic to:
- Power Query (preferred)
- Measures instead of columns
- A dimension table instead of a fact table
6. Power Query (M) Queries That Reference Each Other
Scenario
In Power Query:
- Query A references Query B
- Query B references Query A (or via another query)
Why This Fails
- Power Query evaluates queries in dependency order
- Circular references are not allowed
How to Fix
✅ Create a staging query
- Reference the source once
- Build transformations in layers
Best Practice
- Disable load for intermediate queries
- Keep a clear, one-direction flow of dependencies
7. Sorting a column by another column that derives its value from the column
Scenario
In DAX:
- Column A is being sorted by Column B
- Column B derives from Column A
Why This Fails
- Power BI cannot determine which one to evaluate first
How to Fix: you have two options for resolving this scenario …
✅ Create the calculated columns in reverse order
✅Rewrite at least one of the calculated columns to be derived in a different way that does not reference the other column.
Best Practice
- Keep a clear, one-direction flow of dependencies
How to Diagnose Circular Dependency Issues Faster
Use These Tools
- Model view → inspect relationships and directions
- Manage dependencies (in Power Query)
- DAX formula bar → hover over column and measure references
- Tabular Editor (if available) for dependency visualization
Best Practices to Avoid Circular Dependencies
- Prefer measures over calculated columns
- Keep calculated columns row-level only
- Avoid referencing measures inside calculated columns
- Use single-direction relationships
- Create base measures and build upward
- Push complex transformations to Power Query
Final Thoughts
The “A circular dependency was detected” error is not a bug—it’s Power BI protecting the model from ambiguous or impossible calculation paths.
Once you understand how Power BI evaluates columns, measures, relationships, and queries, this error becomes much easier to diagnose and prevent.
If you treat your model like a clean dependency graph—with clear direction and layering—you’ll rarely see this message again.
