Hi,

I have created using Power Query a connection to a Excel table ("Table1").

The M code is shown in the snapshot below.

Each month this table will be updated by pasting over data for the latest 6 months.

This means that next month the date headers will be 29/02/2020 to 31/07/2020 (so 31/01/2020 drops off and 31/07/2020 is included).

When I try to refresh the query it fails because it can't find the header 31/01/2020 as this date is no longer in the 6 month period used in the source data.

Is it possible to make the query in some way dynamic so that it can cope with changing headers?

Thanks!

PQ M Code Changing Headers.PNG