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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BGR
New Member

Formula: calculate based on the result of the previous calculated row

Hello

I am trying to calculate a growth model. This model uses the previous days data and multiplies this data with a factor. The result is the prediction of the current day. The next day's prediction uses the result from the previous day and applies the same logic again. 

Here is the formula I am currently using but I get this error "A circular dependency was detected: CU - Forecast Model Setup[Model Future Hybrid Hours Build]."

Model Future Hybrid Hours Build = 
if (DATEADD ( 'CU - Forecast Model Setup'[Date] , - 1, DAY ) IN VALUES ( 'CU - Forecast Model Setup'[Date] ),
    VAR CurrentPlatform = 'CU - Forecast Model Setup'[platform_id] 
    RETURN 
        if( 'CU - Forecast Model Setup'[Date] >= TODAY() ,
                CALCULATE(
                    SUM('CU - Forecast Model Setup'[Model Future Hybrid Hours Build]),
                    FILTER( 
                        'CU - Forecast Model Setup',
                        'CU - Forecast Model Setup'[Date] = EARLIER('CU - Forecast Model Setup'[Date]) - 1 &&
                        'CU - Forecast Model Setup'[platform_id] = CurrentPlatform
                    )
                )
                * 
                (1 +
                    CALCULATE(
                        SUM('CU - Forecast Model Setup'[Model Expected Daily Forecast Growth]),
                        FILTER( 
                            'CU - Forecast Model Setup',
                            'CU - Forecast Model Setup'[Date] = EARLIER('CU - Forecast Model Setup'[Date]) - 1 &&
                            'CU - Forecast Model Setup'[platform_id] = CurrentPlatform
                        )
                    )
                )
            ,
            IF( 'CU - Forecast Model Setup'[Date] < TODAY() ,
                'CU - Forecast Model Setup'[Actual Hybrid Hours],
                0
            )
        )
, BLANK()
)

 


In excel I could easily create this model with referencing the formula on the cell above... How could I do this in Powerbi? 

Thank you!

1 REPLY 1
tamerj1
Super User
Super User

Hi @BGR 

It is not clear what are you trying to achieve. Please see if it is something like this 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Recursive-Calculation-and-Forecast-measure/m-...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors