Forum Discussion

s_mansell's avatar
s_mansell
Icon for Helper I rankHelper I
6 years ago

Next 3 months forecast

Hi everyone, 

 

I need some help with putting the next 3 months forecast into a table. This works perfectly fine in a line chart over time however I think I need to make 3 seperate measures to put them as seperate columns in a table. 

 

I have one field for the date e.g "Calander[Date (MMM YY)] and a second field with my forecast data "Sales[Forecast Sales]". 

 

I need the next 3 months to be dynamic hence why I can't simply filter the sales by the correct month. 

 

ActualsForecast 1 (Next Month)Forecast 2 (Next Month +1)Forecast 3 (Next Month +2)
£...£...£...£...

 

Any help would be greatly appreciated! 

5 Replies

  • s_mansell 

     

    I am not sure what you raw data looks like.

     

    so I create three tables.

     

    Actual

    Forecast

    And a calendar table

    Please try below measures

    actual = 
    VAR maxdate=max(ACT[date])
    return CALCULATE(sum(ACT[actual]),FILTER(ACT,ACT[date]=maxdate))
    
    FC1 = 
    var maxdate=max('FC'[date])
    return  CALCULATE(sum(FC[FC]),DATEADD(datetime[Date],1,MONTH))
    
    FC2 = 
    var maxdate=max('FC'[date])
    return  CALCULATE(sum(FC[FC]),DATEADD(datetime[Date],2,MONTH))
    
    FC3 = 
    var maxdate=max('FC'[date])
    return  CALCULATE(sum(FC[FC]),DATEADD(datetime[Date],3,MONTH))

     

    The result depends on the month you selected. Hope this is helpful.

    • s_mansell's avatar
      s_mansell
      Icon for Helper I rankHelper I

      Hi ryan_mayu , 

       

      Unfortunatly I do not have acces to create any tables, all my data is coming from an azure database. 

       

      I am only able to create measures using the existing data. 

       

      I am using two tables which do have relationships between the two: 

      1 tables containing the dates

      1 containing the forecast sales 

       

      • s_mansell's avatar
        s_mansell
        Icon for Helper I rankHelper I

        Hi ryan_mayu , 

         

        I have just tried your measures, I need them to be based off today's date. 

         

        E.G if today is 23/06/2020 then I need the measure to show the forecast value for July, August and September. 

         

        Apologies if I am not being clear!