Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Date table column to show Dynamic Most-Recent entry date up until next entry date

Hello,

I would like help with this scenario I am not able to solve.

The data that I have is as follows:

 

Dates: (CALENDAR TABLE)

IDFiscalYearPeriod
1F1P1
2F1P2
3F1P3
4F1P4
5F1P5
6F1P6
7F1P7

 

Forecasts: (ONLY GET ENTERED EVERY n MONTHS)

IDTitleForecastYearForecastPeriod
1Data1F1P1
2Data2F1P3
3Data3F1P6

 

What I'd like to do is add a column to my Dates table that gets the latest Forecast Year & ForecastPeriod from the Forecasts table up to that FiscalYear & Period.
This way I can add a filter linked to my Dates table, and it would filter my Forecasts table to the most recent entry without going past the selected date in the filter.

i.e.

New Dates:

IDFiscalYearPeriodLatestForecastPeriod
1F1P1P1
2F1P2P1
3F1P3P3
4F1P4P3
5F1P5P3
6F1P6P6
7F1P7P6

 

So with the filters, I could get a result such as the following:

FiscalYear Filter: F1

Period Filter: P4

IDTitleForecastYearForecastPeriod
2Data2F1P3
  • If data is setup the way you have shown above then you can do the following:

    1: Go to Transfrom Data (Power Query)

    2: In the Dates table select "Merge Queries" on Forecast Period on both tables. (as shown below)

     

     

    3: Expand the merged query and select "Forecast Period": 

     

     

    4: Go to Transform tab on the top ribbon and select Fill Down

     

     

    5: Select "Close and Apply". Now you have your desired output. 

     

     

     

     

     

     

     

     

     

     

2 Replies

  • If data is setup the way you have shown above then you can do the following:

    1: Go to Transfrom Data (Power Query)

    2: In the Dates table select "Merge Queries" on Forecast Period on both tables. (as shown below)

     

     

    3: Expand the merged query and select "Forecast Period": 

     

     

    4: Go to Transform tab on the top ribbon and select Fill Down

     

     

    5: Select "Close and Apply". Now you have your desired output. 

     

     

     

     

     

     

     

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much! I was way overthinking it