Issues with Power Query changing the order of columns?

tshives26

New Member
Joined
Sep 19, 2016
Messages
3
I made a comment on the video, but since its from a few years back I was searching for a better place to ask the question. Hopefully I found it :) The question is in regards to this video: https://www.youtube.com/watch?v=a7E29H5ZUmE

I'm having an issue that just arose and I'm hoping you'll be able to help me out. I've been using this method for a few weeks and everything has been working fine. Starting today, when I get to the step where we remove all columns except NoHeader then expand the remaining data to our finished result, PowerQuery is "randomizing" my order of columns for some reason. Before today, this has been working great and keeping all my columns/rows in the order they should be. I haven't changed anything and are still following your steps to a T. Have you ran across this issue before? If so, what's the fix? Thanks for your help ahead of time and keep the great vids coming!

TL:DR - At the final expand after removing headers, PowerQuery is changing the order of my columns for some reason. How do you prevent this?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I noticed this thread was moved. If I posted it in the wrong place, I apologize. I could have sworn I was in this forum. Either or, I'm about up reinstall power query or something as I've exhausted just about every other option I could think of.
 
Upvote 0
Let me post some pictures to maybe help explain what my issue is. I'm assuming by the lack of response either I did not explain it properly, or others have never see this issue. Here goes nothing:

Make note of the column order of my data set in the following screenshot. (Test Suite Execution ID, Execution ID, Sequence, etc) This is immediately after I added a new custom column "Table.PromoteHeaders([data])"

GBCW6JE.png



Next, I go to expand the data. This is where it changes the original column order of my data set.
2Z45oM6.png


The order as you can see is different now. It goes Device Type, End Time, Execution ID, etc. As mentioned above, the order of columns was much different originally.


If we click ok and go to view the data, you can see my columns are now in this new order Power Query decided for me as opposed to the order I previously had setup before starting this process.
eSQ43Dn.png





I hope these pictures can help clear up this issue. I've been searching Google all week for a solution and I can't figure this issue out. It's really racking my brain and I'm hoping someone here with some knowledge can help me solve this issue. Thank you very much!
 
Upvote 0
Table.ColumnNames(#"Removed Other Columns1"{0}) should give you the list of your column names in the desired format.

You can either replace the string in the step "Expanded Custom1" with it or add another step with a dedicated Table.ReorderColumns(#"Expanded Custom1", Table.ColumnNames(#"Removed Other Columns1"{0}))
 
Upvote 0

Forum statistics

Threads
1,225,276
Messages
6,184,008
Members
453,204
Latest member
mamzy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top