Forum Discussion
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:
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
| Client | Item | Qty | ID | Category |
| C01 | USB | 250 | C01_USB | Inventory |
| C01 | LAPTOP | 15 | C01_LAPTOP | Inventory |
| C01 | MOUSE | 35 | C01_MOUSE | Inventory |
Table 2
| Date | Item | Qty Sold | ID |
| Friday, 2/9 | USB | 120 | C01_USB |
| Friday, 2/9 | LAPTOP | 10 | C01_LAPTOP |
| Friday, 2/9 | MOUSE | 20 | C01_MOUSE |
| Saturday 2/10 | USB | 110 | C01_USB |
| Saturday 2/10 | LAPTOP | 0 | C01_LAPTOP |
| Saturday 2/10 | MOUSE | 5 | C01_MOUSE |
| Sunday 2/11 | USB | 20 | C01_USB |
| Sunday 2/11 | LAPTOP | 5 | C01_LAPTOP |
| Sunday 2/11 | MOUSE | 10 | C01_MOUSE |
4 Replies
- Daniel29195Community Champion
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 ,
- MichelleLashNew Member
Is there a way around? or another way to deal with this?
thanks- Daniel29195Community Champion
- Daniel29195Community Champion
are you sure this how the measures should work ?
i mean, measure A depends on B and measure B depends on A ?