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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Breticious
Helper I
Helper I

How to Fix Data Does not Line up with Header

When I export a flat data file to Excel, the headers in Excel are shifted exactly one column to the right of the from the underlying data in the columns. Here is a clip of the export file with some arrows showing the malignment:

Annotation 2019-07-12 153339.jpg

 

Is there a transformation/process that can be used on a single row to push the headers over the right columns of data or is this a lost cause? There is so much else wrong with the file but I can fix those issues.

 

Please help, Almighty Datanaught Community!

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Renaming your columns like so shoud do the job:

 

= Table.RenameColumns(Source, List.Select(List.Zip({Table.ColumnNames(Source), {""} & Table.ColumnNames(Source)}), each _{0} <> null))

Just replace "Source" by a reference to your table if needed.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Community Champion
Community Champion

Renaming your columns like so shoud do the job:

 

= Table.RenameColumns(Source, List.Select(List.Zip({Table.ColumnNames(Source), {""} & Table.ColumnNames(Source)}), each _{0} <> null))

Just replace "Source" by a reference to your table if needed.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

@ImkeF : I like where you are going here and that works to move all columns one to the right. I need to add a new small modification to my question.

 

How can I tweak the starting column as to where to shift? Can I add two columns or do I have to run the process twice?

 

This community is the best!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.