Forum Discussion

RJPK's avatar
RJPK
New Member
6 years ago
Solved

creating forecast based on 1 month

Hi,

 

I'm fairly new to powerBI and i'm struggling to get the correct P&L visual for my forecast.

The ultimate goal is to make a forecast for a new company.

As there is no reference data except for the months starting from jan-2020 I planned to roll forward the actuals of the latest month up to December (average has no use at this stage due to the volatile business).  If needed I will import some manual adjustments for each month.
This way the forecast will be updated each month without having to manualy import the figures. Also the forecast will be built up wihtin the data model allowing me to make visuals on business units, and various reporting levels.

I'm using 3 tables to work the actuals, and thus forecast, out:

  1. Master calendar table generated by DAX calendar formula
  2. dimension table to group the financial data from: grootboek (=ledger and joined with fact on this column) > reporting level 3 > reporting level 2 > total P&L
  3. Fact table containing transaction dates (not full date list of the year, only of transactions), amount, ledger 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After days of searching and trying I came up with the following formula to roll the latest actuals month (march) forward to december:

 

Forecast MTD per Month = 
VAR MaxMonth= 
        CALCULATE(MAX('FACT'[MaxMaandAC]);ALLSELECTED(fact))*1
VAR MTDFC =
    SUMMARIZE('Calendar';'Calendar'[MonthNameShort];
    "LASTMTD";IF(MONTH(MAX('FACT'[Boekingsdatum]))>MAxMonth;CALCULATE([ReportingBedrag AC];ALL('Calendar'[Date]);MONTH('Calendar'[Date])=MaxMonth);[Reporting bedrag MTD AC]))
RETURN
SUMX(MTDFC;[LASTMTD])
+
[ReportingBedrag FCAdj]

 

Where:

MaxmaandAC = column in the fact table stating a month number if the line originates from actual figures, otherwise blank

Boekingsdatum = date of transaction

+[reportingbedrag fcAdj] = imported manual adjustment

 

This formula seems to do exactly what i want: show the actuals if there is data, if there is no data take last actual month. It works in visuals and my matrix on top level:

 

 All totals are correct.

However if i expand one step further the results do not add up:

 

here you see the column "FC netto impact afsluiting" is not filled after March. The row total is correct, but the grand total remains the same.

 

 

Can anyone help me with this? I have searched on "incorrect row totals" a few times but either the solutions i find do not apply for me or I misunderstand them.

 

Thanks!

 

 

 

  • Hi Icey,

     

    When creating the dummy data i discovered my error!

     

    I noticed this when i created the matrix in the dummy file which would not show any months past March.

    The error was in this part:

    SUMMARIZE('Calendar';'Calendar'[MonthNameShort];
        "LASTMTD";IF(MONTH(MAX('fact'[boekingsdatum]))>MAxMonth;CALCULATE([ReportingBedrag AC];ALL('Calendar'[Date]);MONTH('Calendar'[Date])=MaxMonth);[Reporting bedrag MTD AC]))

     

    Right after the first IF i refer to the "fact" table date. This only runs up to March so i need to pick the mastercalender table here like so:

    SUMMARIZE('Calendar';'Calendar'[MonthNameShort];
        "LASTMTD";IF(MONTH(MAX('Calendar'[Date]))>MAxMonth;CALCULATE([ReportingBedrag AC];ALL('Calendar'[Date]);MONTH('Calendar'[Date])=MaxMonth);[Reporting bedrag MTD AC]))

     

    Now i get all details, correct row totals and correct grand total!

3 Replies

  • Icey's avatar
    Icey
    Icon for Community Support rankCommunity Support

    Hi RJPK ,

     

    Please share me a dummy PBIX file, only with the necessary parts, for specific test. Please remove sensitive information and replace real data with dummy data. It is suggested to upload your file to OneDrive for Business and then paste the link here.

     

     

    Best Regards,

    Icey

    • RJPK's avatar
      RJPK
      New Member

      Hi Icey,

       

      When creating the dummy data i discovered my error!

       

      I noticed this when i created the matrix in the dummy file which would not show any months past March.

      The error was in this part:

      SUMMARIZE('Calendar';'Calendar'[MonthNameShort];
          "LASTMTD";IF(MONTH(MAX('fact'[boekingsdatum]))>MAxMonth;CALCULATE([ReportingBedrag AC];ALL('Calendar'[Date]);MONTH('Calendar'[Date])=MaxMonth);[Reporting bedrag MTD AC]))

       

      Right after the first IF i refer to the "fact" table date. This only runs up to March so i need to pick the mastercalender table here like so:

      SUMMARIZE('Calendar';'Calendar'[MonthNameShort];
          "LASTMTD";IF(MONTH(MAX('Calendar'[Date]))>MAxMonth;CALCULATE([ReportingBedrag AC];ALL('Calendar'[Date]);MONTH('Calendar'[Date])=MaxMonth);[Reporting bedrag MTD AC]))

       

      Now i get all details, correct row totals and correct grand total!

      • Icey's avatar
        Icey
        Icon for Community Support rankCommunity Support

        Hi RJPK ,

         

        Glad to hear that. Please accept your reply as a solution so that people who may have the same question can get the solution directly.

         

         

        Best Regards,

        Icey