Forum Discussion

olivere91's avatar
olivere91
Helper I
3 years ago
Solved

Demand Forecast formula help

I'm trying to create a demand forecast for my items. I'm stuck right now on this issue. I have a measure calculating inventory on hand, which is just a sum formula, and another measure calculating d...
  • v-yueyunzh-msft's avatar
    v-yueyunzh-msft
    3 years ago

    Hi, olivere91   

    Thanks for your quick response and sorry for delay response due to my my holiday for several days.
    According to your description, you want to get the [current month value] - [next month value] .
    Here are the steps you can refer to :
    (1)This is my test data:

    (2)We need to create a date table as a dimension:

    Date = ADDCOLUMNS(CALENDAR(FIRSTDATE('Demand_Forecasting'[Date]), LASTDATE('Demand_Forecasting'[Date])) , "Month" , MONTH([Date]) , "Month_Name" , FORMAT([Date] ,"mmmm"))

     

     

     

     (3)In this visual i put the [My Measure] as a value:

    My Measure = SUM('Demand_Forecasting'[On Hand])

     

    (4)Then we can create a measure:

    Measure = var _next_month =  CALCULATE([My Measure] , OFFSET(1,ALLSELECTED('Date'[Month_Name],'Date'[Month]) , ORDERBY('Date'[Month] ,ASC) ))
    return
    IF(_next_month = BLANK() , BLANK() , [My Measure] - _next_month)

     

    (5)Then we can put the fields we need and the measure on the visual and we can get this:

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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