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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
pradnyagophane
Regular Visitor

Need help to resolve circular reference error

I have 4 calculation based on columns index, Allowance of hours (default is 10), Hours used, Credit Hours and Remaining.

Remaining is calculated as : Allowance of hours - Hours used + Credit Hours

From Index 2 onwards, Allowance of hours = Allowance of hours (default is 10) + Remaining of Previous row only in case if it is positive number.

Here, when I try to place calculations for remaining = Allowance of hours - Hours used + Credit Hours, I get circular reference error.

pradnyagophane_0-1719775304523.png

Following are the DAX I used.

PrevRemaining =
VAR StartingPrevBalance = MIN(ProjectServiceAgreements[prevbalance])
 
VAR Previousrow =
CALCULATE (
   [Remaining (or overage)],
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Index]
            = CALCULATE (
                MAX ( 'Calendar'[Index] ),
                FILTER ( ALL ( 'Calendar' ), 'Calendar'[Index] < SELECTEDVALUE ( 'Calendar'[Index] ) )
            )
    )
)
VAR selectedIdx = SELECTEDVALUE ('Calendar'[Index])
RETURN IF(selectedIdx=1,StartingPrevBalance+[Default Allowance of Hours], Previousrow)
  
Allowance of Hours = IF([PrevRemaining]>0, [PrevRemaining]+[Default Allowance of Hours],[Default Allowance of Hours])
 
Remaining (or overage) = [Default Allowance of Hours]-[Hours Used]+[Credit Hours]
Here in this calculation if I place , 
Remaining (or overage) = [Allowance of Hours]-[Hours Used]+[Credit Hours] then I get A circular dependancy issue. 
See the index 5, remaining calculations are wrong as I am not able to refere [Allowance of Hours] due to circu
 
Please help.
5 REPLIES 5
Anonymous
Not applicable

Hi @pradnyagophane ,

 

Please share your sample data and expected results.

 

Best regards,
Community Support Team_ Scott Chang

pradnyagophane
Regular Visitor

Yes, [Allowance of Hours] need to be calculated. Default is 10 hours. But if the previous month remaining is positive value then it becomes 10 + previous month remaining

Anonymous
Not applicable

Hi @pradnyagophane ,

 

The problem is with [Allowance of Hours], how you defined it, please check that its logic applies the values that still need to be calculated.

 

Best regards,
Community Support Team_ Scott Chang

Here I am placing the data and expected result (remianing column)

IndexMonthAllowance of HoursHours UsedCredit HoursRemaining (or overage)
1May-231013.250-3.25
2Jun-231032.750.75-22
3Jul-231035.756-19.75
4Aug-23107.250.53.25
5Sep-2313.257.251.57.5
6Oct-2317.5363.5-15
7Nov-231067.2545.5-11.75
8Dec-231014.55.250.75
9Jan-2410.750010.75
10Feb-2420.7534.510-3.75
11Mar-24101.2508.75
12Apr-2418.757.75011
13May-242110.5010.5
14Jun-2420.50020.5
15Jul-2430.50030.5

 

Allowance of hours calculation:

pradnyagophane_0-1719846606858.png

 

Remaining Calculation:

pradnyagophane_1-1719846668886.png

 

Result is remaining.

Remaining = Allowance of Hours (default is 10) + Remaing of previous month if the number is positive -Hours used + Credit hours.

 

Formula needed to apply in Power BI is to get correct remaining. 

Anonymous
Not applicable

Hi @pradnyagophane ,

 

This seems unachievable. Allowance of hours is used when calculating Remaining.To calculate Allowance of hours, you need to determine the positive or negative of Remaining.

 

Best regards,
Community Support Team_ Scott Chang

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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