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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Joris_NL
Helper III
Helper III

Can't fix Circular dependency error working with Fabric's Semantic model

Hi, I created a Semantic model with Fabric and imported it into PowerBI (Get data - Power BI Semantic models). This works. The tables and relationships appear in PowerBI, and I can calculate measures. Then I change the storage from live to direct query (not to import). This step allows me to create calculated columns. But then the problem arises: in tables on the ‘one’ side of a ‘one-to-many’ relationship, RELATED cannot be used towards the ‘many’ side. The suggestions for columns do not appear when I type the formula. If I write it out anyway, I get a circular dependency error. What is going wrong?

 

Also tested the exact same tables and calculated columns on a direct API source (so not Fabric) with Import mode. Had no problems there.

 

'Import mode' would be fine for this dashboard, but I can't figure out how to change it. Bottom right text button isn't active.

 

Circular dependency2.jpg

 

 

Circular dependency.jpg

1 ACCEPTED SOLUTION
Joris_NL
Helper III
Helper III

My solution has been to change all Calculated columns which depended on RELATED, to m-code query columns. This also removed any circular dependencies. But it took a couple of hours and ended up with AI-generated m-code that's too complex for me to understand.

View solution in original post

3 REPLIES 3
Joris_NL
Helper III
Helper III

My solution has been to change all Calculated columns which depended on RELATED, to m-code query columns. This also removed any circular dependencies. But it took a couple of hours and ended up with AI-generated m-code that's too complex for me to understand.

AmiraBedh
Super User
Super User

You're using a CC in 'PW SHV DossierworkFlow' that references a column in 'PW SHV Task', which in turn filters 'PW SHV DossierworkFlow'. In a Fabric semantic model (similar to Power BI tabular model), relationships are unidirectional, meaning that columns cannot reference measures or calculated columns that depend on them.

Instead of using a CC, you can use a measure that calculates the minimum Startdatum actie dynamically:

FirstStartDate =
VAR KeyValue = SELECTEDVALUE('PW SHV DossierworkFlow'[WorkflowSleutel])
RETURN
CALCULATE(
MIN('PW SHV Task'[Startdatum actie]),
'PW SHV Task'[WorkflowSleutel] = KeyValue
)

 

If you must have it as a column you can create it in Power Query, just merge 'PW SHV Task' with 'PW SHV DossierworkFlow' using WorkflowSleutel and then computeMin(Startdatum actie) for each WorkflowSleutel.

Last step expand and store the result in 'PW SHV DossierworkFlow'.

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Hi Amerah,

Big thanks for the quick response!

First of all, yes, I can make these in M-code. But to illustrate my case I took the easiest column as an example. The other calculated columns depend on multiple conditions which would require a considerably higher number of query steps. However I get the impression that that would still be preferable.

Second is that your solution works, but only for a single calculated column. If I want to add a second one, for instance a LastStartDate using MIN instead of MAX, I get the circular error again. I don't understand why. They use the same selectedvalue of WorkflowSleutel and the same range of Startdates of Task, just to calculate a min instead of max, right? I don't see the loop here.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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