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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Charuta
Frequent Visitor

Circular Dependency Error for Calculate

Hello All,

Need help to fix circular dependency in order to get the final date

In calculations, need to average and then find how much time is required for completion based on last 2 months average.

 

Columns - Status ( there are 2 status - completed and pending) ,project, points, closingdate, work_left

[points] are at [mainkey_id] level and rolled up to project level

work_left is sum of points at [mainkey_id] level with [status] as pending 

DateDim is calculatedtable having all dates and joined with closingdate from Query1

 

based on completed status for last 2 months we add the points per project and take an average.

 

[AvgWorkDone] =

IF(ISBLANK(CALCULATE(SUM('Query1'[points]),DATESBETWEEN(DateDim[Date],TODAY()-60, TODAY()) , ALLEXCEPT('Query1','Query1'[mainkey_id]))/2 ),0,CALCULATE(SUM('Query1'[points]),DATESBETWEEN(DateDim[Date],TODAY()-60, TODAY()) , ALLEXCEPT('Query1','Query1'[mainkey_id]))/2 )

 

The report has to show all data so we have data pulled for last 2 years and for computing final date we need to consider only last 2 months average.

we get the correct average and even if we take the ratio of this average based on the work pending we get the right result in a measure. Calculated Column does not show the right result.

This still works fine, but the calculated number of days are to be added in today's date so using DateAdd get circular dependency. Tried using ALLEXCEPT but nothing works.. 

 

to calculate the final date --- 

CALCULATE
(

DATEADD(
Query1[DateToday],
DIVIDE(
SUM(Query1[work_left]),
CALCULATE(SUM(Query1[AvgWorkDone]),ALLEXCEPT(Query1,Query1[mainkey_id]))
,0)
,DAY)
,ALLEXCEPT(Query1,Query1[[mainkey_id])

 

not sure what needs to be changed or calculated differently. Any help much appreciated

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

If possible, push the calculated columns computation further upstream (into Power Query or the data source). That will avoid the circular reference issue.

 

Same for the DateDim - don't do that in DAX, do it in Power Query or further upstream.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

If possible, push the calculated columns computation further upstream (into Power Query or the data source). That will avoid the circular reference issue.

 

Same for the DateDim - don't do that in DAX, do it in Power Query or further upstream.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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