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,311
try with additional table with headers before and headers after, then append, promote , etc...
 

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
3,311
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,078,437
Messages
5,340,277
Members
399,361
Latest member
Linford

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top