Forum Discussion
DAX Help - Circular Dependency
- 6 months ago
Basically, what is happening here:
“To calculate A I need B, but to calculate B I need A.”
That creates a loop — and DAX does not allow loops in calculated columns.
Proposed solution:
DIVIDE(
Market Share :=
DIVIDE(
SUM(CustomerModelShare[Total Cust Model Build]),
SUM(CustomerModelShare[Total Cust Build])
)
Cust Monthly Model Build :=
IF(
SELECTEDVALUE(CustomerModelShare[Truck Category]) = "CL8",
SUM(CustomerModelShare[Cust Mthly Build]) * [Market Share]
)Now there is:
- No column referencing another column
- No row-by-row dependency
- No circular logic
You created a loop in stored columns.
Move the logic to measures and let Power BI calculate it dynamically.If this helps, ✓ Mark as Kudos | Mark as Solution| Help Others
- 6 months ago
You’re getting the circular dependency because you’re mixing calculated columns that depend on other calculated columns which (directly or indirectly) depend back on the first one.
Market share and “monthly model build” are aggregations and should typically be measures anyway.
Market Share = DIVIDE( [Total Cust Model Build], [Total Cust Build] ) Total Cust Model Build = SUM ( CustomerModelShare[Total Cust Model Build] ) Total Cust Build = SUM ( CustomerModelShare[Total Cust Build] ) Cust Monthly Model Build := IF( SELECTEDVALUE(CustomerModelShare[Truck Category]) = "CL8", [Cust Mthly Build] * [Market Share], BLANK() ) Cust Mthly Build = SUM ( CustomerModelShare[Cust Mthly Build] )
yaya1974 Please confirm:
1. Your model has a calculated column called "CL8 Market Share" or just "Market Share".
2. Does any of the columns [Total Cust Model Build] or [Total Cust Mthly Build] depends on any value of the columns [Cust Monthly Model Build], [Market Share], [CL8 Market Share] ? (Are the measure of the calculated columns [Total Cust Model Build] and [Total Cust Mthly Build] related? have they any relation with the other calculated columns?)