Power Query Heirachy Sort

gazmoz17

Board Regular
Joined
Sep 18, 2020
Messages
158
Office Version
  1. 365
Platform
  1. Windows
Hi,

Is this possible as you would do in excel?

Heirachy sort:

1. Customer
2. SKU

However, after doing the 2nd sort step it forgets sort 1 (prior step) altogether.

1684766071441.png


Thanks
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You can do this by separating them by a comma within the same Sort step.

Power Query:
= Table.Sort(#"Previous Step",{{"Customer", Order.Ascending}, {"SKU", Order.Ascending}})
 
Upvote 0
Argh thanks Johnny I knew there was no way this couldnt be done 🤦🏼‍♂️ such a simple requirement.
 
Upvote 0
Default sorting of PQ is hierarchical. The UI does what Johnny wrote in his code. I wonder how you tried to the sorting then?
 
Upvote 0
At least in my version, you are prompted to either update the existing step or create a new one. It isn’t always default to be in the same step.
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,594
Members
452,654
Latest member
mememe101

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