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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Winter_king94
Helper I
Helper I

Remove circular dependency from calculated column

Hello, I have converted an excel formula into a calculated column. This calculated column (Lookup Customer Sector) produces the exact results I need, which is combining the sector from multiple tables based on various fields into one spot.
I'm newer to PBI and the easiest way for me to validate & create this column was by using variables.
The problem I am running into is that I need to use this calculated column to join with another table, but when I go to make the relationship I get the error that 'Lookup Customer Sector' can't be used due to circular dependencies. 

Can someone please help me figure out a way to write this calculated column that removes the circular dependencies?

 

 

Lookup Customer Sector =

VAR Step1 = IF('OBIEE - COGS'[End Customer Account Number] = "141398", "Medical - Aesthetic Therapy",
                IF((LEFT('OBIEE - COGS'[Item Num],2) = "LQ" || LEFT('OBIEE - COGS'[Item Num],3) = "BLQ" || LEFT('OBIEE - COGS'[Item Num],4) = "RPLQ"), "Spec Ind - Liquid Cool Elect", BLANK()))

VAR STEP2 = IF( Step1 = BLANK(), LOOKUPVALUE('Customer Sector (Product Line) Key'[Sector], 'Customer Sector (Product Line) Key'[Product Line], 'OBIEE - COGS'[PRODUCT_HIER_GROUPING]), Step1)

VAR STEP3 = IF( Step2 = BLANK(), LOOKUPVALUE('Customer Sector (Item#) Key'[Sector], 'Customer Sector (Item#) Key'[Item#], 'OBIEE - COGS'[Item Num]), STEP2)

VAR STEP4 = IF(STEP3 = BLANK(), LOOKUPVALUE('Oracle End Cust #'[End Customer Sector], 'Oracle End Cust #'[End Customer Account Number], 'OBIEE - COGS'[End Customer Account Number]), STEP3)

VAR STEP5 = IF(STEP4 = BLANK(), LOOKUPVALUE('Customer Sector (Account) Key'[Sector], 'Customer Sector (Account) Key'[Account Number], 'OBIEE - COGS'[Bill to Customer Account Num]), STEP4)

VAR STEP6 = IF(AND(STEP5 = BLANK(), LEFT('OBIEE - COGS'[PRODUCT_HIER_GROUPING],2) = "LQ"), "Spec Ind - Liquid Cool Elect", STEP5)

VAR STEP7 = IF(STEP6 = BLANK(), 'OBIEE - COGS'[Customer Sector], STEP6)    

RETURN
STEP7

This is what the field looks like and gets used in visuals with other fields such as item number, end customer, bill to customer, etc.
Winter_king94_0-1776271328589.png

 


thanks in advance!
1 ACCEPTED SOLUTION
krishnakanth240
Resident Rockstar
Resident Rockstar

Hi @Winter_king94 

Because calculated column uses LOOKUPVALUE across tables that are related to same table creating a dependency loop.

 

So, do not use a calculated column and convert it into a measure or power query column. Move this logic to power query, merge tables step by step like your VAR logic and create the column there

View solution in original post

5 REPLIES 5
Winter_king94
Helper I
Helper I

thank you! I will work on moving this over to Power Query

You're welcome @Winter_king94! Sure

Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result very clearly.  Explain the business logic clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

I have converted an excel formula into a calculated column

Don't do that. Power BI is not Excel.  Formulate the business problem and then design a native solution based on Power BI's capabilities.

 

As @krishnakanth240 mentioned one of the recommended approaches to get rid of the circular dependency is to push that column generation up into Power Query.

krishnakanth240
Resident Rockstar
Resident Rockstar

Hi @Winter_king94 

Because calculated column uses LOOKUPVALUE across tables that are related to same table creating a dependency loop.

 

So, do not use a calculated column and convert it into a measure or power query column. Move this logic to power query, merge tables step by step like your VAR logic and create the column there

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.