I'm using a GroupBy in my datasource for a Gallery-SubGallery set up. I'm taking data from an OrderDetails table which includes an OrderHeaderID which is the field I am grouping on.
GroupBy(Filter('[Order].[OrderDetail]',OrderDetailTimeInt >= varTodayInt) ,"OrderHeaderID","GrpOrderByHeader")
By befault, the records appear to be shown in the Gallery in Ascending order (of the OrderHeaderID). I would prefer they be shown in descending order. I have tried adding a Sort to the formula as follows:
SortByColumns(GroupBy(Filter('[Order].[OrderDetail]',OrderDetailTimeInt >= varTodayInt) ,"OrderHeaderID","GrpOrderByHeader"),"OrderHeaderID",Descending)
Unfortunately, this not only appears to have a considerable hit on performance but doesn't actually perform a sort, instead mixing up the records so I actually get multiple copies of the same OrderHeaderID with only some of the related records appearing under each.
Is there a way to sort the result set of a GroupBy? What I really want to do is lookup the OrderHeaderDate for each OrderHeaderID and sort by that, but as OrderHeader records have an auto-incrementing ID, sorting by the ID would be sufficient for now...
Solved! Go to Solution.
Hi @PaulD1 ,
Thanks for the response! 🙂 I am using Sub Gallery same with you toturial.
Can my Groupby sorted by ascending or descending on (eg OrderID)?
Sorts are Ascending by default, but just specify Descending as an additional parameter - e.g.
Check out new user group experience and if you are a leader please create your group
Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.