Forum Discussion
Circular Dependency - Only calculate rows before current row
Your post is a little confusing, could you post any sample or upload the pbix, do mask sensitive data before uploading, you can upload it to Onedrive or any other web storage.
- shawnprodgers10 years agoRegular Visitor
Hi Eric,
Thank you for your response. Attached is a model that has two tables. One is the desired outcome, the other is the same table with fact columns and calculated columns trying to get the desired outcome with the circular dependency present. The key field is the Condition Volume Total and the key ability is to be able to include the volume that has met a condition into the net total of volume in the Condition Volume Total field. We can't use measures given that each row must be analyzed individually so unless we created a report table that shows every row (which obviously isn't ideal), we want to accomplish this with calculated columns.
Herer is the One Drive link: https://1drv.ms/u/s!AgADk3HM2f_cki_o1vMGVr4Dk6Nh
Really appreciate your time,,
Shawn
- Eric_Zhang10 years ago
Microsoft Employee
Thanks for sharing the pbix. The formula looks good. Not sure what did you do, however when I create a new column with the exactly same formula, the circular dependency error doesn't occur and the output seems good.
For readability, you can format the the DAX formular on DAX formatter.
Condition Volume Total = [Volume] + CALCULATE ( SUM ( Test1[Volume] ), FILTER ( ALL ( Test1 ), AND ( Test1[Contract] = EARLIER ( Test1[Contract] ), Test1[Index.1] < EARLIER ( Test1[Index.1] ) ) ) ) + CALCULATE ( CALCULATE ( SUM ( Test1[Qualified Volume] ), Test1[Condition Positive] = "Yes" ), FILTER ( ALL ( Test1 ), Test1[Index.1] < EARLIER ( Test1[Index.1] ) ) )Understanding Circular Dependencies for your reference.
- shawnprodgers10 years agoRegular Visitor
Hi Eric,
Thanks for taking a look. I agree the formula works as is. The central issue I have is I need to reference the total of the formula in the Condition Volume Total column so when I do the Condition Test formula, it is calculating on the desired volume total. Even if I create a new column with the stated functioning formula, when I try to reference is in the Conditional Volume Total column, the circular reference returns and I'm back to square one. Any ideas?
Appreciate your time,
Shawn