Forum Discussion
Khomotjo
Helper II
1 year agoCircular Dependency
Hello Everyone, I have the following calculated table :
Previous_Days_Late_Lines =
VAR CurrentDate = StockMovements[Required_Date]
VAR PreviousDate = TRUNC(StockMovements[Previous_Date])
RETURN
CALCULATE(
DISTINCTCOUNT(StockMovements[Product_Code]),
FILTER(
ALL(StockMovements),
TRUNC(StockMovements[Required_Date]) = PreviousDate && StockMovements[FinalisedDate] > StockMovements[Required_Date])),
previous date is also a calculated coloumn :
Previous_Date = IF(
WEEKDAY(StockMovements[Required_Date],2) =1,
StockMovements[Required_Date]-3,
StockMovements[Required_Date]-1)
The measure was updating well, but now it gives a "circular dependency error". Is there a way to get around this without creating a static previous date coloumn?
3 Replies
- Sahir_Maharaj
Super User
Hello Khomotjo,
Can you please try calculating the PreviousDate inline using a variable:
Previous_Days_Late_Lines = VAR CurrentDate = StockMovements[Required_Date] VAR PreviousDate = IF( WEEKDAY(CurrentDate, 2) = 1, CurrentDate - 3, CurrentDate - 1 ) RETURN CALCULATETABLE( DISTINCT(StockMovements[Product_Code]), FILTER( ALL(StockMovements), TRUNC(StockMovements[Required_Date]) = PreviousDate && StockMovements[FinalisedDate] > StockMovements[Required_Date] ) ) - Khomotjo
Helper II
Thanks Sahir_Maharaj but above still returns circular dependency
- AnonymousNot applicable
Thank you Sahir_Maharaj
Hi, KhomotjoIn my test, there is no circular dependency problem with your expression, can you provide some test data so that I can better analyze your requirements? You need to describe the results you expect based on the sample data you provide, so that I can try to write an expression for you that fits your business logic.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.