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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

need help with subtracting between two new calculated columns

Hello,

 

   This might be a simple answer, but i've been struggling with this. I have 2 new columns in a table in Power BI. There are specific calculations for each of those columns. now that I have those working, I just need to create a 3rd column that subtracts the value between the two. For example, The 2 columns I have are named FC, RP, and they each hold the value 2, 4. So I just need to subtract the 2 in a 3rd column, but I keep running into a "circular dependency was detected" issue. I've tried removing filters and a few other things I found online, but nothing's working for me. It seems like it should just be a simple calculation, or maybe i'm overthinking this? Any help on this would be great. 

 

Untitled.png

Note: The other 2 calculated columns don't reference any other table, they calculated from values within the same table. 

5 REPLIES 5
Anonymous
Not applicable

Below are the 2 custom columns I created. 

RP = CALCULATE(SUM(TABLE[QTY])-CALCULATE(IF(SUM(TABLE[QTY])<AVERAGE(TABLE[CASE_CAPACITY]),0,IF(AVERAGE(TABLE[CASE_CAPACITY])=0,0,IF(OR(CONTAINS(TABLE,TABLE[VAS],"CASE PACK VAS"),CONTAINS(TABLE,TABLE[VAS],"GOH + CASE PACK VAS")),0,ROUNDDOWN((AVERAGE(TABLE[CASE_CAPACITY])/SUM(TABLE[QTY]))*SUM(TABLE[QTY]),0))))),REMOVEFILTERS(TABLE[FC])
)

FC = CALCULATE(IF(SUM(TABLE[QTY])<AVERAGE(TABLE[CASE_CAPACITY]),0,IF(AVERAGE(TABLE[CASE_CAPACITY])=0,0,IF(OR(CONTAINS(TABLE,TABLE[VAS],"CASE PACK VAS"),CONTAINS(TABLE,TABLE[VAS],"GOH + CASE PACK VAS")),0,ROUNDDOWN((AVERAGE(TABLE[CASE_CAPACITY])/SUM(TABLE[QTY]))*SUM(TABLE[QTY]),0))))
)

v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

 

A circular dependency is detected whenever two objects reference each other, in such a way that Power BI cannot process the objects.

Refer to:

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

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

I've read through this article, and I think I understand what a circular dependency is, I just don't see how it's being applied here. All I'm doing is subtracting between the two columns I created in DAX. When looking at the code for those two columns, they're not referring each other, they both refer to other columns within the tables. Would it help if I were to put the code of those 2 columns here? 

Greg_Deckler
Super User
Super User

@Anonymous If you have a truly recursive formula then there may not be a solution. DAX hates recursion. Previous Value (“Recursion”) in DAX – Greg Deckler



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

No recursion formulas at all.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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