Hi
I have a situation where i need to import data every other day as a new column and i need to be able to change the header of the imported column to Todays Date - as Text so it stays permenantly to the date of the import.
Is this possible in Power Query?
I am using Excel 2016
Many thanks for any pointers
GreenBoy
In theory yes, but I haven't seen your data so it's difficult to be specific.
Assuming the new data has a column header that is today's date, or at least different to all column headers in the existing query, then you can merge the new query with the existing one it will be added as a new column. You can then rename the column with today's date.
That said, it's not the correct format to have a column for each date's data. Better to have a column that contains the date and then a column/s that contain the other information. From there you can create a PivotTable to show the dates across the columns.
Mynda
Thanks Mynda
After scratching around for a while i found this solution - not too elegant, but works
I grab the new data,
demote the headers,
add a custom column filled with today's date called today,
add conditional column that looks for the header in the data column i want to keep if found use value in the custom column else use value from the Data column
Promote headers
delete unwanted columns,
Merge to original data set
And that's it - as i say not elegant but it works
Lesson learnt - the solution isn't always a cool function in M code, but sometimes just a bunch of simple steps to move stuff around....
Thanks again
GreenBoy
Glad you found a solution. I wouldn't worry about having a load of steps to get to the end result. It often doesn't make the query any less efficient than a single custom M function 🙂