cancel
Showing results for
Did you mean:
Helper V

## DAX Forecast Forward

I have found a DAX formula that forecasts deaths in US compared to actual deaths. Is there a way to get this to forecast forward (e.g. 2022) rather than overlapping?

`Expected Deaths = var currentWeekNo = SELECTEDVALUE('Date'[WeekNo])var currentYear = SELECTEDVALUE('Date'[Year])var sameWeeksPriorTo2020 = SUMMARIZE(    FILTER(        ALL('Date'),         'Date'[WeekNo] = currentWeekNo && year('Date'[Date])<2020    ),    'Date'[WeekID])var deathsinSameWeeksPriorTo2020 = CALCULATETABLE(ADDCOLUMNS(sameWeeksPriorTo2020, "deaths", [Deaths]), ALL('Date'))var minDeaths = MINX(deathsinSameWeeksPriorTo2020, [deaths])var maxDeaths = MAXX(deathsinSameWeeksPriorTo2020, [deaths])var rowCount = COUNTROWS(deathsinSameWeeksPriorTo2020)var deathGrowth = DIVIDE(maxDeaths-minDeaths, rowCount-1)return IF([Deaths]<>BLANK(),maxDeaths+(currentYear-2020+1)*deathGrowth)`

1 ACCEPTED SOLUTION
Community Support

Hi @Niiru1 ,

I'm not sure about the context of your formula.To be sure, if you want to continue calculating the results for the next year, you need to iterate the deathGrowth results for 2021.

If you are using a line chart, perhaps the built-in forecasting function can meet your needs.

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 REPLIES 3
Community Support

Hi @Niiru1 ,

I'm not sure about the context of your formula.To be sure, if you want to continue calculating the results for the next year, you need to iterate the deathGrowth results for 2021.

If you are using a line chart, perhaps the built-in forecasting function can meet your needs.

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Super User

@Niiru1 , Based on what I got

Only after today, or taken max date from data

//change return like

return IF([Deaths]<>BLANK() && max('Date'[Date]) >=today() ,maxDeaths+(currentYear-2020+1)*deathGrowth)

New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!
Helper V

Yeah this works to get me up to today's data / expected data but I'm trying to push it forward on the X-axis into 2022. Perhaps a DATEADD(Date[Date])), +4,QUARTERS) or something like this?

Announcements