Power Query Editor sort changes order on rows with same value

Stian Egge
New Contributor



I'm having a problem with the power query editor sorting rows it should not change order on. My goal with PQE is to show a summary of tasks from a "mission log", sorting based on two seperate columns. The PQE reads a log-table where all logs are written in chronological order.


My goal is 

1. To sort tasks with highest priority on top. (Named "PRI")

2. Leave tasks within the same priority in same order (oldest on top to newest on bottom). (Named "NR"). The "NR" is the log entry number. From first to last. 


See the attached screenshots. You only need to consider the columns named "NR" and "PRI".  For example, for the priority "B", the "NR"-order should be 5-6-7 after sorting according PRI (A-B-C).Sort error before.pngThe table before sorting accorcing to priority (PRI) A to ESort error after.pngThe table after sorting according to PRI. The "NR"-order is not chronological within the same "PRI".

2 Replies

Hi Stian,


Right after sorting PRI sort NR column as well. In the formula bar you'll see like this

= Table.Sort(#"Previous Step",{{"PRI", Order.Ascending}, {"NR", Order.Ascending}})


Thanks a lot, that worked!

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies