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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. 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
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors