Forum Discussion
marinahani
1 year agoNew Member
Circular Dependency - 2 columns referencing each other
Hi - would appreciate some help on this. This is what I have right now. But the correct calculation for TotalCurrentMonth should also include value from FromPreviousMonth. Which then causes the c...
- 1 year ago
I took your suggestion and did some tweaks and it worked. Managed to get the result exactly as needed
CALCULATE(SUMX('MRR Level 2','MRR Level 2'[New Logo] +'MRR Level 2'[Cross Sell] +'MRR Level 2'[True Up] +'MRR Level 2'[Price Increase] +'MRR Level 2'[True Down] +'MRR Level 2'[Price Decrease] +'MRR Level 2'[Churn]) ,FILTER(ALL('MRR Level 2'[FirstofMonthMRRDate]),'MRR Level 2'[FirstofMonthMRRDate] <= MAX('MRR Level 2'[FirstofMonthMRRDate]))
FarhanJeelani
Super User
1 year agoHi marinahani ,
You're encountering a circular dependency issue because TotalCurrentMonth depends on FromPreviousMonth, and FromPreviousMonth depends on TotalCurrentMonth. To resolve this, you need to break the dependency by using variables or iterators.
Try this approach:
DAX
VAR PrevMonthValue =
CALCULATE(
MAX('MRR Level 2'[TotalCurrentMonth]),
DATEADD('MRR Level 2'[FirstofMonthMRRDate], -1, MONTH)
)
RETURN
SUMX(
'MRR Level 2',
PrevMonthValue +
'MRR Level 2'[New Logo] +
'MRR Level 2'[Cross Sell] +
'MRR Level 2'[True Up] +
'MRR Level 2'[Price Increase] +
'MRR Level 2'[True Down] +
'MRR Level 2'[Price Decrease] +
'MRR Level 2'[Churn]
)
- The PrevMonthValue variable fetches the previous month's TotalCurrentMonth without creating a direct dependency.
- The calculation then adds up the values without referencing FromPreviousMonth in a way that causes a loop.
If you still face issues, consider storing FromPreviousMonth in a separate calculated table and referencing it instead.
Please mark this post as solution if it helps you. Appreciate Kudos.
marinahani
1 year agoNew Member
I tried but it didnt work, so I started to create a separate calculated table for PreviousMonth, but then I tried the Cumulative Sum approach suggested and it worked