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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Forecast - Recurrence logic error

Hi!

 

I want to make a forecast based on some different calculated columns.

My starting point is the number of Closed cases per day. This is a simple logic.

Next, I calculate the Rolling average of closed cases per employee. Dax below:

Closed_cases_on_date_person rolling average = 
VAR __LAST_DATE = LASTDATE('Dates'[Date])
RETURN
    AVERAGEX(
        DATESBETWEEN(
            'Dates'[Date];
            DATEADD(__LAST_DATE; -30; DAY);
            __LAST_DATE
        );
        CALCULATE(AVERAGE(Dates[Closed_Per_Person])
    ))+0

Using this, I forecast the upcoming number of total cases that will be closed: 

Closed_cases_on_date_forecast = 
IF(Dates[Date] <= TODAY();CALCULATE (
    DISTINCTCOUNT ( UserActivity[ID] );
    FILTER (
        UserActivity; UserActivity[To status] in {"Closed"; "Canceled"} &&
        DateValue(UserActivity[EndDate]) =  Dates[Date]
    )
)+0;
Dates[Closed_cases_on_date_person rolling average] * [FTEs_Active])

Now I would like to combine this logic. I would like my rolling average to be based on Closed_cases_on_date_forecast and also the other way around. This way, I want to have a longer forecast that automatically uses previously forecasted numbers.

 

How can I do this?

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please have a try 🙂

 

Closed_cases_on_date_forecast =
VAR __LAST_DATE =
    LASTDATE ( 'Dates'[Date] )
VAR average =
    AVERAGEX (
        DATESBETWEEN ( 'Dates'[Date]; DATEADD ( __LAST_DATE; -30; DAY ); __LAST_DATE );
        CALCULATE ( AVERAGE ( Dates[Closed_Per_Person] ) )
    ) + 0
RETURN
    IF (
        Dates[Date] <= TODAY ();
        CALCULATE (
            DISTINCTCOUNT ( UserActivity[ID] );
            FILTER (
                UserActivity;
                UserActivity[To status] IN { "Closed"; "Canceled" }
                    && DATEVALUE ( UserActivity[EndDate] ) = Dates[Date]
            )
        ) + 0;
        average * [FTEs_Active]
    )
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please have a try 🙂

 

Closed_cases_on_date_forecast =
VAR __LAST_DATE =
    LASTDATE ( 'Dates'[Date] )
VAR average =
    AVERAGEX (
        DATESBETWEEN ( 'Dates'[Date]; DATEADD ( __LAST_DATE; -30; DAY ); __LAST_DATE );
        CALCULATE ( AVERAGE ( Dates[Closed_Per_Person] ) )
    ) + 0
RETURN
    IF (
        Dates[Date] <= TODAY ();
        CALCULATE (
            DISTINCTCOUNT ( UserActivity[ID] );
            FILTER (
                UserActivity;
                UserActivity[To status] IN { "Closed"; "Canceled" }
                    && DATEVALUE ( UserActivity[EndDate] ) = Dates[Date]
            )
        ) + 0;
        average * [FTEs_Active]
    )
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.