Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply

Excel data-source headings keep changing every month.

I'm looking for a solution to an issue i'm having with a client. 

I have made them a power BI dashboard which works. Each month the client would like to update the datasource with a new excel file containing the same data as the previous excel file. However, quite often the column headers of the datasource change. This of course, causes issues with the dashboard when the new data source is uploaded.

 

For example:

"Total Income" changes to become "Total income (CT)"

or

"Commission Fee" changes to become "Commission Fee (AZ)".

 

Changes like this occur almost every month.

 

They do not have control of their datasource as it is exported from a third party software (which changes the column headers regularly).

 

This makes reporting quite difficult. 

 

However, the order of the columns remains the same. I was hoping I could replace the column headers with A B C D E F G etc and then change them in a later step to work around this issue. 

 

Is this possible in Power Query?

 

Any help would be greatly appreciated.

 

Thank you.

 

 

 

3 REPLIES 3
parry2k
Super User
Super User

@AndrewDavies437 it should work fine as well.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@AndrewDavies437 yes it possible, add the following steps to rename the columns, 

 

Old Column Name steps - gets the existing columns name of the table from the previous step

New Column Name steps - a list of column names you want to be, make sure these column names are in the correct order.

Rename column steps renames the old columns with the new columns. 

 

With this solution it doesn't matter what is the column name in the excel file, as far as number of columns are the same, it should work.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI0MjAAUgpKsTrRSkZAlhFEwMJYFSxkDGRbgkV0TS2BQrEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CINESEMANA = _t, PÚBLICO = _t, #"VAR%" = _t]),
    #"Old Column Names" = Table.ColumnNames(Source),
    #"New Column Names" = { "Test1", "Test2", "Test3"},
    #"Rename Columns" = Table.RenameColumns(Source,List.Zip({#"Old Column Names",#"New Column Names"}))
in
    #"Rename Columns"

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thank you for the reply!  

 

I have tried another method that seems simpler, but would like to know if this is going to cause any issues because it seemed too easy. 

AndrewDavies437_0-1657815047407.png

 

I just deleted the "promoted headers" step and renamed my columns to what they'd want to be, then removed the first row (the headers).

 

Will this run into issues down the line?

 

If it does I will use your method but is there any reasons we aren't just doing it like this?

 

Thanks so much for your time. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.