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
cqueiroz2222
Helper I
Helper I

How to solve circular dependency

I'am trying to calculte my result + another measure but it keeps generatin circular results

Circular Dependency: Measure: 'Medidas'[Result], Measure: 'Medidas'[Total Variable], Measure: 'Medidas'[Value to rec Step I], Measure: 'Medidas'[Result Aloc Step I], Measure: 'Medidas'[C/C], Measure: 'Medidas'[Result].

 

Result =
VAR vPreviousMonth = CALCULATE([Total Variável], PREVIOUSMONTH(dim_Calendario[Data]))
VAR vCurrentMonth = [@Result]
RETURN
    vPreviousMonth + vCurrentMonth
 
C/C =
VAR CurrentDate = MAX('dim_Calendario'[Data])
RETURN
    SUMX(
        FILTER(
            ALL('dim_Calendario'),
            'dim_Calendario'[Data] <= CurrentDate
        ),
        [Result]
    )

Result Aloc Step I =
CALCULATE(
    IF(
        [C/C] < 0, 0,
            IF([C/C] > 0,
                IF([C/C] < [Target, [C/C], [Target])
            )
    )
)
 
Value to rec Step I = [Result Aloc Step I] * [% Step I]

Total Variable = [Value to rec Step I] + [Value to rec Step II]
7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with, explain the question in simple English and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
pborah
Solution Sage
Solution Sage

@cqueiroz2222 , What action triggers that error?

Hello @pborah when I try to calculate

C/C based on the [Result]:

 

Result =
VAR vPreviousMonth = CALCULATE([Total Variável], PREVIOUSMONTH(dim_Calendario[Data]))
VAR vCurrentMonth = [@Result]
RETURN
    vPreviousMonth + vCurrentMonth

Thanks @cqueiroz2222 can you tell me the order of your measure calculations? As in which one you are calculating first, second, third,......, last?

Hello @pborah 

Ok, see below the order. All the measures that I am using is these ones above. Please let me know if you need them again

1. Calculating the result:

2. Calculating C/C
3. Calculating Value to rec Step I
4. Calculating Value to rec Step II
5. Calculating Total Variable = [Value to rec Step I] + [Value to rec Step II]
6. Adding Total Variable into Result = [Result] + [Total Variable]

In the moment I add Total Variable into Result, the circular dependency apperars

Se the measure below:
Resultado Realizado =
VAR vResult = [@Result]

RETURN
    vResult + [Total Variable]

@cqueiroz2222 can you please provide calculations for #3, and #4?

Hello, @pborah 

Of course, see below:

Value for Rec = [Result I] * [% Result I]

 

Result I ​​= CALCULATE( IF( [C/C] < 0, 0, IF([C/C] > 0, IF([C/C] < [Target], [C/C], [Target]) ) ) )

 

The central idea is: AFTER all my calculations, I want to get the value that results in [Total Variable] and “return” to [Result] as compensation based on the previous month

Example:

If I had a result of 140 in the current month

And I had a variable in the previous month of 500,

I want this variable value to be added in the current month and therefore recalculate all other measures that depend on [Result] without generating circular dependence

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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