In this video, Dhruvin talks about how to sort arrays in Power Automate. The Sort-function is needed to sort an array in Power Automate. By default, it sorts in Ascending order. To reverse the order, the Reverse-function can be used.
For an alternative way to sort an array, this post can be helpful. It shows how to sort with an Office Script.
https://www.tachytelic.net/2021/03/power-automate-sort-array/
Pieter Veenstra explained how to sort arrays in Power Automate using an Azure function. However, this requires a premium license. Therefore, he also explains how to do it in 3 easy steps with Excel in Power Automate:
https://sharepains.com/2020/03/05/sort-an-array-in-power-automate/
Another alternative to sort arrrays in Power Automate is building a custom code connector as shown here:https://steelcutbytes.com/2021/10/09/sort-array-in-power-automate-using-custom-code-connector/