Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Create forecast aggregate balance by day, using loan start date, maturity date, notional

Hello

 

I have a large dataset of trades (loans), which I would like to transform into a table showing the aggregate balance sheet runoff over time, with the date being the column header in the resulting table or matrix.  In essence this is a balance sheet forecast using contractual data, going out several years.  I would like to calculate and show this by day (columns), and then subsequently aggregate by month, year, etc.

 

Each trade has start date, maturity date and notional, with example data below.

 

I would like the starting B/S date to be 31/12/21, and cover a 5 year period to 31/12/26. 

 

I believe the right approach might involve creating a separate date table showing all the days from and until these dates, and additionally some kind of measure that applies a filter using the start/maturity dates...e.g. the total for a given day sums all balances for trades whose start dates are <= that day, and whose maturity dates are > that day.

 

I have tried a few approaches on this theme so far with no success.  Im not sure it would be all that helpful to post any of my failed code as a starting point for discussion, hopefully community members will be able to suggest what they would do from scratch.

 

I have been chasing my tail on this for a few days, so any help would be hugely appreciated!

 

If I have ommitted any key information please do let me know and I will happily elaborate.

 

Thank you in advance!

 

Trade IDStart DateMaturity DateRemaining Notional
102-May-2101-May-26146
203-Jan-2001-Jan-2537
303-Jul-1901-Jul-2489
407-Sep-2006-Sep-25129
527-Jun-2026-Jun-25100
611-Nov-1810-Nov-2356
704-Jul-2103-Jul-2670
814-Aug-2113-Aug-26137
920-Dec-2019-Dec-2592
1018-Dec-1916-Dec-2440
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    I suggest you to create a calendar table and then create a measure and show your result in a matrix.

    Calendar = 
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2021, 01, 01 ), DATE ( 2025, 12, 31 )),
        "Year", YEAR ( [Date] ),
        "Month", MONTH ( [Date] ),
        "End Date of Year", DATE ( YEAR ( [Date] ), 12, 31 )
    )
    

    Measure:

    Basic = 
    VAR _ENDDATE =
        SELECTEDVALUE ( 'Calendar'[End Date of Year] )
    RETURN
        IF (
            _ENDDATE >= MAX ( 'Table'[Start Date] )
                && _ENDDATE <= MAX ( 'Table'[Maturity Date] ),
            CALCULATE ( SUM ( 'Table'[Remaining Notional] ) )
        ) + 0
    Forecast Remaining Notional = 
    SUMX (
        FILTER ( 'Table', SELECTEDVALUE ( 'Calendar'[End Date of Year] ) <> BLANK () ),
        [Basic]
    )

    Create a matrix, you need to turn off "Stepped layout" in Row headers and turn off the subtotal you don't need in Format. Result is as below.

    You can download my sample file to learn more details.

     

    Best Regards,
    Rico Zhou

     

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

8 Replies

  • You may need to explain what a notional is.  It would also help if you could indicate the expected outcome based o the sample data you provided.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Sorry, notional just means balance.

     

    OK, so if I calculate this for the year end dates as a concise example, we would get something like the below table.  The forumulae in cell E2, for example, is very simply =IF(AND(B2<=E1,C2>E1),D2,0).

     

    As I say, the actual output would need to be for all days through time, not just the year end dates.

     

    Trade ID

    Start DateMaturity DateRemaining Notional31/12/2131/12/2231/12/2331/12/2431/12/25
    102-May-2101-May-26146146146146146146
    203-Jan-2001-Jan-2537373737370
    303-Jul-1901-Jul-248989898900
    407-Sep-2006-Sep-251291291291291290
    527-Jun-2026-Jun-251001001001001000
    611-Nov-1810-Nov-23565656000
    704-Jul-2103-Jul-26707070707070
    814-Aug-2113-Aug-26137137137137137137
    920-Dec-2019-Dec-2592929292920
    1018-Dec-1916-Dec-244040404000
    Total   896896840711353
      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Ibendlin

         

        I think the other solution more directly gives me what I need, although it was useful to see, for example, the slicer tool in action, so I definitely learned something!  Thanks for taking the time to look at this, I appreciate it.

         

        Steve

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous ,

       

      I suggest you to create a calendar table and then create a measure and show your result in a matrix.

      Calendar = 
      ADDCOLUMNS (
          CALENDAR ( DATE ( 2021, 01, 01 ), DATE ( 2025, 12, 31 )),
          "Year", YEAR ( [Date] ),
          "Month", MONTH ( [Date] ),
          "End Date of Year", DATE ( YEAR ( [Date] ), 12, 31 )
      )
      

      Measure:

      Basic = 
      VAR _ENDDATE =
          SELECTEDVALUE ( 'Calendar'[End Date of Year] )
      RETURN
          IF (
              _ENDDATE >= MAX ( 'Table'[Start Date] )
                  && _ENDDATE <= MAX ( 'Table'[Maturity Date] ),
              CALCULATE ( SUM ( 'Table'[Remaining Notional] ) )
          ) + 0
      Forecast Remaining Notional = 
      SUMX (
          FILTER ( 'Table', SELECTEDVALUE ( 'Calendar'[End Date of Year] ) <> BLANK () ),
          [Basic]
      )

      Create a matrix, you need to turn off "Stepped layout" in Row headers and turn off the subtotal you don't need in Format. Result is as below.

      You can download my sample file to learn more details.

       

      Best Regards,
      Rico Zhou

       

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

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Rico

         

        Many thanks for taking the time to look at this.  I have modified the solution to provide a monthly view, and it seems to work fine!

         

        I have one further questions if I may.  I have created a table report with two columns: calendar months and the Forecast Remaining Notional measure.  Is it possible to achieve the same simple table as an underlying data table, as opposed to a report, i.e. run the measure within a new column for the list of "End Date of Months" per the calendar?  Reason being is that this would then allow me to export the table to excel.

         

        Thanks