Results 1 to 6 of 6

Thread: Power Query - Dynamic Column Headers - By Date
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2019
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Power Query - Dynamic Column Headers - By Date

    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.

  2. #2
    Board Regular sandy666's Avatar
    Join Date
    Oct 2015
    Posts
    3,009
    Post Thanks / Like
    Mentioned
    33 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Power Query - Dynamic Column Headers - By Date

    try with additional table with headers before and headers after, then append, promote , etc...
    I know you know but I forgot my Crystal Ball and don't know what you know



    In the first post, show the type of machine (PC / Mac) and the Office version you are working on
    I don't use vba in any form!

  3. #3
    New Member
    Join Date
    May 2019
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Power Query - Dynamic Column Headers - By Date

    Hi sandy666,

    Can you explain?

  4. #4
    Board Regular sandy666's Avatar
    Join Date
    Oct 2015
    Posts
    3,009
    Post Thanks / Like
    Mentioned
    33 Post(s)
    Tagged
    1 Thread(s)

    Cool Re: Power Query - Dynamic Column Headers - By Date

    Post representative example of source data and expected result
    Last edited by sandy666; Oct 14th, 2019 at 02:23 PM.
    I know you know but I forgot my Crystal Ball and don't know what you know



    In the first post, show the type of machine (PC / Mac) and the Office version you are working on
    I don't use vba in any form!

  5. #5
    New Member
    Join Date
    May 2019
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Power Query - Dynamic Column Headers - By Date

    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.

  6. #6
    Board Regular sandy666's Avatar
    Join Date
    Oct 2015
    Posts
    3,009
    Post Thanks / Like
    Mentioned
    33 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Power Query - Dynamic Column Headers - By Date

    I am glad you solved your problem

    Have a nice day
    I know you know but I forgot my Crystal Ball and don't know what you know



    In the first post, show the type of machine (PC / Mac) and the Office version you are working on
    I don't use vba in any form!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •