Forum Discussion

Tobz007's avatar
Tobz007
Frequent Visitor
1 year ago
Solved

How to create a Dynamic 15 Months Forecast

Hi, I'm trying to create a 15 months forecast with the sample data below for each client on a monthly basis, I'll also like to apply a reduction factor (percentage) to the forecast result 12 months into the forecast based on a selected value (I'll create a slicer for this based on a factor table I'll create).

To create some context, the data for each Client is generated on a monthly basis (granularity) so its fine for the forcast to be monthly too, the assumption is that the Data table has data up to the maximum Current year month, what I'll like to do is show a forecast based on past data (assuming there is 3 years worth of data but forcast can be based on last 12 months), I can't use LINESTX because I'm stuck with an old Power Bi version so I need to come up with other solution either using DAX measures, or creating the forcast in power wuqry or combine both.

I have attached a sample table.

Date (Month)ClientRevenueCostForecasted RevenueForecasted Cost
01-Jan-24A57692.0140384.41  
01-Jan-24B58804.3241163.02  
01-Jan-24C13008.069105.64  
01-Feb-24A17022.6911915.88  
01-Feb-24B36181.7725327.24  
01-Feb-24C55339.1838737.43  
01-Mar-24A51527.6736069.37  
01-Mar-24B59660.2041762.14  
01-Mar-24C48252.3533776.65  
01-Apr-24A42848.9829994.29  
01-Apr-24B45355.0131748.51  
01-Apr-24C77968.3854577.87  
01-May-24A58854.2841198.00  
01-May-24B2204.651543.26  
01-May-24C24024.6016817.22  
01-Jun-24A15454.1410817.90  
01-Jun-24B39337.2027536.04  
01-Jun-24C31359.5221951.66  
01-Jul-24A22033.1015423.17  
01-Jul-24B60219.6842153.78  
01-Jul-24C2532.681772.88  
01-Aug-24A1332.11932.48  
01-Aug-24B73139.4951197.64  
01-Aug-24C4187.822931.47  
01-Sep-24A9166.606416.62  
01-Sep-24B14545.0010181.50  
01-Sep-24C6197.654338.36  
01-Oct-24A472.90331.03  
01-Oct-24B216.47151.53  
01-Oct-24C8.335.83  
01-Nov-24A5849.644094.75  
01-Nov-24B4695.693286.98  
01-Nov-24C3761.552633.09  
01-Dec-24A  60576.6142403.63
01-Dec-24B  61744.5443221.18
01-Dec-24C  13658.469560.92
01-Jan-25A  17873.8212511.68
01-Jan-25B  37990.8626593.60
01-Jan-25C  58106.1440674.30
01-Feb-25A  54104.0537872.84
01-Feb-25B  62643.2143850.25
01-Feb-25C  50664.9735465.48
01-Mar-25A  44991.4331494.00
01-Mar-25B  47622.7633335.93
01-Mar-25C  81866.8057306.76
01-Apr-25A  61796.9943257.90
01-Apr-25B  2314.881620.42
01-Apr-25C  25225.8317658.08
01-May-25A  16226.8511358.79
01-May-25B  41304.0628912.84
01-May-25C  32927.5023049.25
01-Jun-25A  23134.7616194.33
01-Jun-25B  63230.6644261.46
01-Jun-25C  2659.311861.52
01-Jul-25A  1398.72979.10
01-Jul-25B  76796.4653757.53
01-Jul-25C  4397.213078.05
01-Aug-25A  9624.936737.45
01-Aug-25B  15272.2510690.58
01-Aug-25C  6507.534555.27
01-Sep-25A  496.55347.58
01-Sep-25B  227.29159.11
01-Sep-25C  8.756.12
01-Oct-25A  54518.9538163.26
01-Oct-25B  55570.0838899.06
01-Oct-25C  12292.628604.83
01-Nov-25A  16086.4411260.51
01-Nov-25B  34191.7723934.24
01-Nov-25C  52295.5336606.87
01-Dec-25A  48693.6534085.55
01-Dec-25B  56378.8939465.22
01-Dec-25C  45598.4731918.93
01-Jan-26A  40492.2928344.60
01-Jan-26B  42860.4830002.34
01-Jan-26C  73680.1251576.08
01-Feb-26A  55617.2938932.11
01-Feb-26B  2083.391458.38
01-Feb-26C  22703.2515892.27



Thanks.


  • Hello Tobz007,

     

    Can you please try the following:

    Dynamic 15Month Forecast Revenue = 
    VAR CurrentDate = MAX('DataTable'[Date])
    VAR Last12MonthsAvgRevenue = 
        CALCULATE(
            AVERAGE('DataTable'[Revenue]),
            DATESINPERIOD('DataTable'[Date], CurrentDate, -12, MONTH)
        )
    VAR ReductionFactor = SELECTEDVALUE('Factor Table'[Factor], 1)
    VAR MonthDiff = DATEDIFF(CurrentDate, TODAY(), MONTH)
    VAR BaseForecastRevenue = IF(
        ISBLANK('DataTable'[Revenue]),
        Last12MonthsAvgRevenue,
        'DataTable'[Revenue]
    )
    RETURN
        IF(
            ISBLANK('DataTable'[Revenue]),
            IF(
                MonthDiff > 12,
                BaseForecastRevenue * ReductionFactor,
                BaseForecastRevenue
            ),
            'DataTable'[Revenue]
        )
    

     

3 Replies

  • Hello Tobz007,

     

    Can you please try the following:

    Dynamic 15Month Forecast Revenue = 
    VAR CurrentDate = MAX('DataTable'[Date])
    VAR Last12MonthsAvgRevenue = 
        CALCULATE(
            AVERAGE('DataTable'[Revenue]),
            DATESINPERIOD('DataTable'[Date], CurrentDate, -12, MONTH)
        )
    VAR ReductionFactor = SELECTEDVALUE('Factor Table'[Factor], 1)
    VAR MonthDiff = DATEDIFF(CurrentDate, TODAY(), MONTH)
    VAR BaseForecastRevenue = IF(
        ISBLANK('DataTable'[Revenue]),
        Last12MonthsAvgRevenue,
        'DataTable'[Revenue]
    )
    RETURN
        IF(
            ISBLANK('DataTable'[Revenue]),
            IF(
                MonthDiff > 12,
                BaseForecastRevenue * ReductionFactor,
                BaseForecastRevenue
            ),
            'DataTable'[Revenue]
        )
    

     

    • Tobz007's avatar
      Tobz007
      Frequent Visitor

      Thanks for this Sahir_Maharaj I made some modifications but your response was a great pointer.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Tobz007 

    May I ask if you have gotten this issue resolved? If it is solved, please share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.


    If it is not resolved, I hope you will provide the full .pbix file via OneDrive or SharePoint. Please be careful to remove all sensitive information and we will do our best to provide ideas for your issue.

     

     

     

    I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
    Best Regards,
    Fen Ling,
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.