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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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