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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Circular dependency using Calculate

For a calculation I have created two column measures. The first calculates the # empty values in a row, the second calculates # values in the row that are not labelled as "N/A". However when trying to calculate these two measures at the same time I get an error saying that circular dependency is found. I think the reason is because I do two calculations on the same Table.

 

1st column measure:

empty count = CALCULATE(COUNTROWS(Sorted),Sorted[Value]="")
 
2nd column measure:
totalcount = CALCULATE(COUNTROWS(RELATEDTABLE(Sorted))-CALCULATE(COUNTROWS(Sorted),FILTER(Sorted,Sorted[Value]="N/A")))
 
How do I calculate this without the circular dependency?
 
The background is that I want to calculate these per row for variables in Table A [200 x 200 entries] and to make this calculation in the first place I made a pivot table (called Sorted) to make this calculation in the first place. Using measures (not column measures) I can not visualize it in a table due to the 1:n relationship, resulting in a n : n visualization.
3 REPLIES 3
Anonymous
Not applicable

The easiest way is to make the calculations in Power Query. If you want to remove the circ dep in DAX, avoid CALCULATE, which effects contex transition (placing filters on all columns in the table), and rely only on FILTER.

parry2k
Super User
Super User

@Anonymous it will be easier if you post sample data and expected output and how these tables are related. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Sorry, it took a while to rebuild my .pbix file to allow for posting in this thread.

 

There are two table visualizations in the PBI Dashboard. My goal is to have the 2 columns (Expected Result and Empty Information Fields [Alphabeticaly] in the same visualization and ordered per Variable (1 time per Variable). Now when I add both columns to the same visual the table shows each Variable a number of n times, n being the number of Empty Information Fields.

 

To obtain this I have tried adding colum measure NewTable[empty count] and NewTable[totalcount]. However, having both these measures introduces the circular dependency. 

 

Link to .pbix file 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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