Forum Discussion

readyOH's avatar
readyOH
Frequent Visitor
10 years ago
Solved

How to do a Forecast?

Hi,

 

I know that the forecast functionnality has been removed from PowerBI https://support.powerbi.com/forums/265200-power-bi/suggestions/8790061-add-forecasting-feature

 

but do you have a formula (dax) for it? For example it generates an average of the previous months and generates a trend for the next 3 months.

 

Thanks

16 Replies

    • readyOH's avatar
      readyOH
      Frequent Visitor

      thank you Greg_Deckler  I am not familiar with linear regression. I have have this sample data

       

      MonthSales
      January375,09
      February375,01
      March375
      April374,95
      May374,93
      June374,92
      July374,88
      August374,8
      September374,71
      October ?
      November ?
      December ?

       

      What I want to do : a formula which calculates automatically the sales for the next three months, based on an average of the previous month. if we are in september, it generates a trend for oct/nov/dec based on the average. If we are in december, then jan/feb/march.

       

      Can you help me?

       

       

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Assuming that "," are "." in my geographic context, I plugged your numbers into my model and came up with:

         

        Data:

        X,Y
        1,375.09
        2,375.01
        3,375.00
        4,374.95
        5,374.93
        6,374.92
        7,374.88
        8,374.80
        9,374.71

         

        Estimates (from linear regression)

        10,374.72

        11,374.68

        12,374.64

         

        That's linear regression, if you want a rolling average, then you could use the pattern here:

        http://www.daxpatterns.com/statistical-patterns/

         

         

        For rolling average. However, I cannot tell from your information how many months that you want to include in your rolling average, the last 3 months? So September would take into account July, August and September to predict December, June, July and August to predict November and May, June, July to predict October, or do you want all available dates to be used in prediction such that [Start] through July to predict October, [Start] through August to predict November and [Start] through September to predict December? Or something else all together??

  • I took the approach of using DAX to grab historical points in a time-series to plot future values (via measures). The trick was in creating a date table that had future dates to serve as the parent to the data table. Although this is a rather simple approach, I was able to get a pretty accurate fit for web traffic that still allowed PowerBI cross-viz drill-functionality and PowerBI service support (wheras R does not). I have the pbix file and the supporting data sets in the zip at the bottom of the post.

     

    http://fountainanalytics.com/creating-simple-time-series-forecasting-using-microsoft-powerbi-and-dax/

     

    Regards,

      David

    • Bustardo's avatar
      Bustardo
      Helper I

      Sorry for the bit of Thread necromancy but I'm having an issue.  I used David's solution to attempt to do a forecast and I can't understand the behavior that is occuring with the visual.

       

      I have a count and a Trend count, I also have some filters on the side.

       

      After I click on any filter the Values disappear for the Trend Line when using the line and stacked column chart.

       

      I used “see data” on the first visual, and the Data is there for Claims (trend 2)

      I did this on the 2nd Visualization as well, where the Trend Line vanishes. But when I look at the See data there Is data for those dates. Any idea what’s going on?

    • Deepikasubu's avatar
      Deepikasubu
      Frequent Visitor

      Hi David the link doesnt have any attachment. Please help in getting those. I am so interested in viewing the post.