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
Mic1979
Post Partisan
Post Partisan

Sorting all columns in one step

Dear all,

 

I have a table with many columns, and I need to sort them. Target is for me to speed up the grouping step, and I read some resoucres in the web that Grouping can be faster if the data are pre-sorted.

 

Coming back to the sorting, is there a way to make it in one step intead of making it for each column?

 

What I did on sample file is this one:

#"Sorted Rows" = Table.Sort(#"Removed Columns",{{"Region", Order.Ascending}, {"Port_Type_1_2", Order.Ascending}})

 

I was thinking of  using the following:

Headers = Table.ColumnNames(StuffingBoxChange2),
HeadersToRemove = List.Combine({{"Y3"},{"OEM_Y3_Volumes"},{"DISTRIBUTOR_Y3_Volumes"}}),
HeaderDifference = List.Difference(Headers,HeadersToRemove),

 

and at the end using HeaderDifference to select the column to sort.

 

Could you support?

 

Thanks.

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi @Mic1979 

 

#"Sorted Rows" = Table.Sort(#"Removed Columns", List.Transform(HeaderDifference, each {_, Order.Ascending}))

 Stéphane

View solution in original post

2 REPLIES 2
slorin
Super User
Super User

Hi @Mic1979 

 

#"Sorted Rows" = Table.Sort(#"Removed Columns", List.Transform(HeaderDifference, each {_, Order.Ascending}))

 Stéphane

Thanks!

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.