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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SajjadMousavi
Helper II
Helper II

Circular reference error in calculated column when adding second one

Hi.

I have a table and have added this calculated column with no problem:

 

RunningTotalTransWeight = CALCULATE(SUM(InventTrans[TransWeight]), InventTrans[TransDate] <= EARLIER(InventTrans[TransDate]))
 
Now I want to add another one with this code:
 
RunningTotalFinancialCostAmount = CALCULATE(SUM(InventTrans[FinancialCostAmount]), InventTrans[TransDate] <= EARLIER(InventTrans[TransDate]))
 
When I want to save it, I receive this error:
 
A circular dependency was detected: InventTrans[RunningTotalFinancialCostAmount], InventTrans[RunningTotalTransWeight], InventTrans[RunningTotalFinancialCostAmount].
 
Codes for both columns are almost the same, just the field which calculation is based on differs. Why this happens?
 
Thanks in advance.
1 ACCEPTED SOLUTION
MahyarTF
Memorable Member
Memorable Member

Hi, 

As I saw in your codes, you are using the dependency code and you need to change your code to fix the issue.

please have a look at the below article :

https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/

Mahyartf

View solution in original post

3 REPLIES 3
SajjadMousavi
Helper II
Helper II

Thank you both @MahyarTF and @MFelix . According to links you provided, I added an index column and applied ALLEXCEPT on it to change Power BI behavior.

MahyarTF
Memorable Member
Memorable Member

Hi, 

As I saw in your codes, you are using the dependency code and you need to change your code to fix the issue.

please have a look at the below article :

https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/

Mahyartf
MFelix
Super User
Super User

Hi @SajjadMousavi,

 

What's is hapenning is related with the context transiction

 

Please check this blog post with a detailed explanation

 

https://community.powerbi.com/t5/Community-Blog/Circular-Dependency-between-Calculated-Columns-in-a-...

 

To what I can understand you want to calculate cumulatives values is this correct?  In this case I advise for you to use a measure instead of calculated columns they will not be dependent on this context transiction and will be much more flexible in the use. 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.