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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MichelleLash
New Member

Circular Dependency Open-Close Balance

I am trying to generate a Balance, but I get a circular dependency.
The Initial Balance (the day the report is consulted will be Day 1) is the sum (Table1[Qty]). Then from second day on, it will be Final Balance
Sales, Sum Table2[Qty Sold] of the corresponding day
Final Balance, it will be Initial Balance - Sales.

Also, the visual is a matrix and it should be possible to get to see the values of Initial Balance, Sales and Final Balance per item.

What im looking for: 

Screenshot SP.png

Dax: 

  •  Inventory = Calculate(

    SUM ( 'Table1'[Qty] )
)

 

 

  • Sales = Calculate(

    SUM ( 'Table2'[Qty Sold] )
)

 

  • Initial Balance = IF(

    MAX(Dates[Date]) = TODAY(),

    [Inventory],

    CALCULATE([FinalBalance],PREVIOUSDAY(Dates[Date])

))

 

  • Final Balance = IF(

    MAX(Dates[Date]) = TODAY(),

   [Inventory] - [Sales],

   [Initial Balance] - [Sales]

)



Tables: Table1, Table2 and a calendar table called Dates(columns= Year, Month, Day)

Table 1

ClientItemQtyIDCategory
C01USB250C01_USBInventory
C01LAPTOP15C01_LAPTOPInventory
C01MOUSE35C01_MOUSEInventory

Table 2

DateItemQty SoldID
Friday, 2/9USB120C01_USB
Friday, 2/9LAPTOP10C01_LAPTOP
Friday, 2/9MOUSE20C01_MOUSE
Saturday 2/10USB110C01_USB
Saturday 2/10LAPTOP0C01_LAPTOP
Saturday 2/10MOUSE5C01_MOUSE
Sunday 2/11USB20C01_USB
Sunday 2/11LAPTOP5C01_LAPTOP
Sunday 2/11MOUSE10C01_MOUSE
4 REPLIES 4
Daniel29195
Super User
Super User

@MichelleLash 

are you sure this how the measures should work ? 

i mean,  measure A depends on B  and measure B depends on A  ? 

 

 

 

 

Daniel29195
Super User
Super User

@MichelleLash 

im not sure if you need help detecting the dependency or you need help with the dax ;

but anw, i will point to the dependency , 

Daniel29195_0-1707507185200.png

 

 

Is there a way around? or another way to deal with this?
thanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.