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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Shippior
Helper II
Helper II

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

@Shippior 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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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