This is my first time facing an issue like this. Basically I am attempting to perform the computation below:
My Measures (NB: All my measures are in the table MeasureFuel):
daily_closing_useful_stock = 'MeasureFuel'[daily_closing_global_fuel_stock] - sum(Parameters[Dead stock (Liter)]) /* Final Result */
daily_closing_global_fuel_stock = 'MeasureFuel'[opening_global_fuel_stock] + sum('Daily Input'[Daily Delivery (Liter)]) - sum('Daily Input'[Daily Consumptions (Liter)])
opening_global_fuel_stock = if ('MeasureFuel'[daily_closing_fuel_stock_pd] <> 0, 'MeasureFuel'[daily_closing_fuel_stock_pd], sum(Parameters[Opening Global fuel Stock (Liter)])
daily_closing_global_fuel_stock_pd = CALCULATE( 'MeasureFuel'[daily_closing_global_fuel_stock], PREVIOUSDAY(DimDate[Date]))
My issue is this: When I try to save the measure opening_global_fuel_stock, i get the error "A circular dependency was detected"
How can I fix this??
Hi @divo ,
Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.
Hi @divo ,
There is a good description for circular dependencies: https://www.sqlbi.com/articles/understanding-circular-dependencies/.
It does not allow to have two calculated columns that contain measures that are also based on that table. As a workaround, you may try to convert these into measures instead of column.
You can refer to the similar case: "A circular Dependency was detected" error while creating a calculated column.
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Are you sure those are measures? Some of those look like calculated columns, and it is easy to get into a circular dependency in a calculated column.
You can greatly avoid much of this by calculating those columns in Power Query and bring them in there if possible. If not, you have to understand how CALCULATE() actually uses every column behind the scenes to do its work when used in a calculated column, so if the calculated column references columns A and B, it really references all columns when determining row context, then you do another calculated column with CALCULATE, it references all existing columns, but your first column you created now refrences this second one too, and you get a circular dependency. It can get complex.
You can read more details here, or you can see Chapter 5 of "The Definitive Guide to DAX 2nd Edition" if you really want to dig in to this.
Ok. The standard way to refer to measures is just [MeasureName] with no table. Measures can be anywhere. Unlike TableName[FieldName] would refer to a specific field in a table. That is why I thought those were calculated columns. Table names in formulas refer to specific fields.
[daily_closing_global_fuel_stock_pd] (1) is referring to [daily_closing_global_fuel_stock] (2) and (3), which is referring to [opening_global_fuel_stock] (4) and (5), which is referring back to [daily_closing_global_fuel_stock].
That is where your circular reference error is coming from I think.
Check out new user group experience and if you are a leader please create your group
Click here to read more about the April 2021 Updates!
100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.
See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.