Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
MiXiang
Frequent Visitor

Need Help in Resolving Circular Dependency

I'm seeking assistance in creating a DAX formula within Power BI that can avoid circular dependencies. This challenge arises because my calculation involves recursion, but I'm optimistic that it can be resolved, as my results are accurate up to the sixth month.

Let's delve into the specifics:

1. Variables:
- NP_B: Data sourced from Excel.
- ND_B: Data sourced from Excel.
- NS_B: Data sourced from Excel.

2. Dependency Relationships:
- NP is dependent on the previous values of ND and NS.
- ND relies on ND_B, NP_B, and NP in its calculation.
- NS depends on NP_R and incorporates a percentage.

The crux of the issue lies in circular dependency:
- NP_R is utilized in both ND and NS calculations, creating a loop. This circular dependency is where I require guidance and a workaround solution tailored to Power BI.

In essence, I'm looking for a DAX formula that allows these interdependent variables to coexist without causing circular dependencies within Power BI.

Thanks a lot!!!

The formula for NP ND NS NP_R:

NP = Previous ND+PreviousNS

ND = ND_B * (NP_R/NP_B-1)

NS = (NP_R*)/3

NP_R = NP_B + NP

5768BF9E-E4E7-440B-9B8D-8AA1AB9D348D.png

65455D3E-6178-40FE-8A4F-07AA73BE9596.png

78D0EA75-3E34-46E7-803D-5AE3FB7C4D7D.png

D7B36AB2-6E6F-482A-8280-92428359D26B.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @MiXiang ,

Circular dependencies in Power BI can occur when two or more objects reference each other in a way that Power BI cannot process. Here are some common scenarios and solutions:

  • Calculated Columns Referencing Each Other: If you create two calculated columns that reference each other, you are generating a circular dependency. For example, if Line Margin is computed based on Discount Pct, and Discount Pct is computed based on Line Margin, you have a circular dependency. The solution is to rephrase your code.
  • Context Transition Inside a Calculated Column: If you use CALCULATE in a calculated column, it performs a context transition and makes that column dependent on all the columns in the table. If two such columns exist, they depend on each other, causing a circular dependency. The solution is to restrict the list of columns that the calculated column depends on by using ALLEXCEPT or REMOVEFILTERS and keeping only the table’s primary key.
  • Creating a Relationship Involving a Calculated Column or Table: This can also cause a hidden circular dependency.

You can review the following links to understand circular dependencies, avoid it and how to fix it when you got the circular dependencies error.

Understanding circular dependencies in DAX - SQLBI

Avoiding circular dependency errors in DAX - SQLBI

How to fix:

A circular dependency was detected power bi: Easy Fix - YouTube

Circular Dependency Breaker DAX Functions ️ || How to Fix Circular Dependency in Power BI - YouTube

 

If the above ones still not help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @MiXiang ,

Circular dependencies in Power BI can occur when two or more objects reference each other in a way that Power BI cannot process. Here are some common scenarios and solutions:

  • Calculated Columns Referencing Each Other: If you create two calculated columns that reference each other, you are generating a circular dependency. For example, if Line Margin is computed based on Discount Pct, and Discount Pct is computed based on Line Margin, you have a circular dependency. The solution is to rephrase your code.
  • Context Transition Inside a Calculated Column: If you use CALCULATE in a calculated column, it performs a context transition and makes that column dependent on all the columns in the table. If two such columns exist, they depend on each other, causing a circular dependency. The solution is to restrict the list of columns that the calculated column depends on by using ALLEXCEPT or REMOVEFILTERS and keeping only the table’s primary key.
  • Creating a Relationship Involving a Calculated Column or Table: This can also cause a hidden circular dependency.

You can review the following links to understand circular dependencies, avoid it and how to fix it when you got the circular dependencies error.

Understanding circular dependencies in DAX - SQLBI

Avoiding circular dependency errors in DAX - SQLBI

How to fix:

A circular dependency was detected power bi: Easy Fix - YouTube

Circular Dependency Breaker DAX Functions ️ || How to Fix Circular Dependency in Power BI - YouTube

 

If the above ones still not help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.