Power Query - Dynamic Column Headers - By Date

lager1001

New Member
Joined
May 17, 2019
Messages
19
I import a file each day that contains about 40 columns of data. 15 of the 40 column headers are dates for the next 15 days from the current date. Therefore, each day the column headers change in the source data for those 15 columns. My refresh will crash each day since it cannot find the exact same column names from the previous day. I found the following youtube video which explains how you can rename the columns dynamically but it doesn't appear to be working for me (I get a token comma expected error and have followed the coding exactly). Additionally, the video only shows the coding for dynamically updating 1 column header. Does anyone know how to dynamically update multiple column headers each time a fresh is done to prevent crashing?

https://www.youtube.com/watch?v=yBJr0sAc-m4

Thank you.
 

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
3,231
try with additional table with headers before and headers after, then append, promote , etc...
 

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
3,231
Post representative example of source data and expected result
 
Last edited:

lager1001

New Member
Joined
May 17, 2019
Messages
19
I was able to figure this out. I made a separate worksheet for the headers only but it was just a range, not a table, since you can't have formulas in table headers. I then made the column names all the same except for the dated ones which i used formulas for to pull the proper new names for. I then pulled a Power Query out of this worksheet, promoted first row to headers and appended the source data file with the changing dated headers. Works great.
 

Forum statistics

Threads
1,077,917
Messages
5,337,163
Members
399,129
Latest member
ericosman

Some videos you may like

This Week's Hot Topics

Top