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
ngct1112
Post Patron
Post Patron

Re-order column

Hi All, I am working on the data set in SQL which may change regularly.

I would like to keep 2 columns always at the begining and doesn't matter for the rest.

1. "ID"

2. "Item"

 

is there any way I could achieve that without inputting other column names in the query?

 

= Table.ReorderColumns(#previous_step,{"ID", "Item" ......})

 

 

Thanks!

1 ACCEPTED SOLUTION
wdx223_Daniel
Community Champion
Community Champion

=let col=Table.ColumnNames(PreviousStep) in Table.ReorderColumns(PreviousStep,List.Sort(col,{{each List.PositionOf({"Item","ID"},_),1},each List.PositionOf(col,_)}))

View solution in original post

1 REPLY 1
wdx223_Daniel
Community Champion
Community Champion

=let col=Table.ColumnNames(PreviousStep) in Table.ReorderColumns(PreviousStep,List.Sort(col,{{each List.PositionOf({"Item","ID"},_),1},each List.PositionOf(col,_)}))

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.

Top Solution Authors