Forum Discussion
A circular dependency was detected
- 1 year ago
Hi PranavR ,
Thanks for reaching out to the Microsoft fabric community forum.
Please go through the below documents which may help you in resolving the issue:
FIX CIRCULAR DEPENDENCY ERROR / 2 Common Scenarios and how to fix them / Beginners Guide to Power BI
Solved: Need Help in Resolving Circular Dependency - Microsoft Fabric Community
Solved: Circular dependency - Microsoft Fabric Community
If I misunderstand your needs or you still have problems on it, please feel free to let us know.Best Regards,
Menaka.
Community Support Team
Recommended Fix: Use Power Query Instead of Calculated Columns
To avoid circular dependency and still get the desired Date, do this:
Option 1: Precalculate the Date in Power Query
-
Go to Power Query (
Transform Data) -
In the
SalesAnalysis table:-
Add a custom column like:
powerquery
= if [Type] = "Monthly" and [Month] <> null and [Day] <> null then
#date([Year], [Month], [Day])
else if [Type] = "Weekly" then
null
else
null
-
After that, merge with the
Dim Calendar table on[YearWeek] (only for "Weekly" type rows) -
From that merged table, bring in the
[Date] column -
Final step: create a single
Date column that pulls either the monthly date or the merged weekly dateThis avoids using DAX for something that’s fundamentally a data transformation task.
Option 2: Rebuild the Date Outside the Relationship Logic
If you must use DAX:
-
Don't use
CALCULATE(MAX(...)) that depends on the related table.Instead, consider bringing YearWeek-Date mapping as a lookup column into the
SalesAnalysis table using Power Query or with a LOOKUPVALUE if small and not recursive:
Weekly_Dt = LOOKUPVALUE('Dim Calendar'[Date], 'Dim Calendar'[YearWeek], 'SalesAnalysis'[YearWeek])
LOOKUPVALUE is a scalar function and doesn't drag in the entire filter context, making it safe to use without triggering circular dependencies — in most cases.Did I answer your question? Mark my post as a solution! Appreciate your Kudos !PranavR
-
-
-