Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Solution
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Sort an array with a single Power Automate expression

Posted on September 25, 2022September 25, 2022 by Tom

“I can’t believe that Power Automate is missing such a basic functionality as a possibility to sort an array, is there no easy way how to do that?”


When you work with arrays or arrays of objects, you might want to organise them. And the most basic way to organise it is sorting. Sort names alphabetically, dates earliest to latest, numbers lowest to highest… But only some of the Power Automate action give you the possibility to sort the result, with the others you needed a complex workaround. Until now.

Sort in ascending order with sort() expression

As shown by Paul in his video, a few more expressions were added to Power Automate. One of them is the sort(…) expression, and as the name suggests, it’ll sort an array. Depending on the array it can have one or two parameters.

If it’s a simple array, the only parameter is the array to sort:

sort(<array>)

Note: < … > is a placeholder, replace it with your array including < and >.

If it’s an array of object, it needs two parameters – the array to sort and the sorting property:

sort(<array>, '<property>')

Note: < … > are placeholders, replace them including < and >.

Power Automate sort array

Sort in descending order with reverse() expression

There’s no third parameter for the sort(…) to decide on the sorting order, it’s always ascending. To sort the array the other way around you must combine it with the reverse(…) expression.

Reverse(…) by itself doesn’t sort the array, it’ll just reverse its order. Therefore, if you want a reversed array, you must sort it first and then reverse the result.

reverse(sort(<array>))

Summary

With the new Power Automate expressions it became very easy to sort any array. Instead of cumbersome workarounds you can sort any array with just one or two expressions. Sort(…) to sort it in ascending order, or combination with reverse(…) to go descending.


πŸš€ Master Power Automate

Join 2,100+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

4 thoughts on “Sort an array with a single Power Automate expression”

  1. Gonzalo Nava says:
    May 25, 2023 at 8:06 pm

    This is the best way to sort arrays.

    Reply
    1. Ben says:
      December 11, 2023 at 5:22 pm

      No, there is a sort expression now.

      Reply
  2. Chris says:
    December 18, 2024 at 3:49 pm

    hi – thanks for the helpful site! Can you sort by two or more properties?

    Reply
    1. Tom says:
      February 23, 2025 at 1:53 pm

      Hello Chris,
      I’d think that you can use multiple sort expressions like: sort(sort(sort(, <1stsort>), <2ndsort>), <3rdsort>)

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,100+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Get the Approval Process solution and the Task Delegation App to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes