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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Khomotjo
Helper II
Helper II

Circular 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 3
Khomotjo
Helper II
Helper II

Thanks @Sahir_Maharaj  but above still returns circular dependency

Anonymous
Not applicable

Thank you Sahir_Maharaj 
Hi, @Khomotjo 

In 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.

vjianpengmsft_0-1737618211405.png

vjianpengmsft_1-1737618225734.png

vjianpengmsft_2-1737618243970.png

 

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.

Sahir_Maharaj
Super User
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]
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors