web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sorting in descending ...
Power Apps
Unanswered

Sorting in descending order

(1) ShareShare
ReportReport
Posted on by 90

hi Expert i have a gallery trying to sort 

 

code i have  

With({_items: SortByColumns(
 Filter(Opportunity, "ID",
 country= CTDDL_5.Selected.Result|| CTDDL_5.Selected.Result=Blank(),
 remediationstatus=stageDDL_5.Selected.Result||stageDDL_5.Selected.Result=Blank()
 ), "opportunityname","opportunitydescription","Title", If(SortDescending1,SortOrder.Ascending,SortOrder.Descending)
 )
 }, 
 Filter(
 _items, TextInput3_5.Text in opportunitydescription|| TextInput3_5.Text in opportunitynumber||TextInput3_5.Text in referenceid
 )
)

 i want to sort the gallery based on latest id.  my latest id is 49 but its random

 

Vedant28_0-1719936807660.png

 

 

Categories:
I have the same question (0)
  • developingteal Profile Picture
    392 on at

    do something like Sort(table, ID, sortorder.descending)

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Vedant28,

     

    Thank you for providing the code snippet and screenshot! 😊

     

    The currenct code was sorting based on multiple columns with a conditional ascending / descending value. Additionally, the text value ID was written as a Filter parameter - not as a SortByColumns parameter.

     

    In case you only want to sort the datasource descendingly based on ID, you can use the code below:

    With(
     {
     _items: Filter(
     Opportunity, 
     country = CTDDL_5.Selected.Result || CTDDL_5.Selected.Result=Blank(),
     remediationstatus = stageDDL_5.Selected.Result || stageDDL_5.Selected.Result=Blank()
     )
     }, 
     Sort(
     Filter(
     _items, 
     TextInput3_5.Text in opportunitydescription || TextInput3_5.Text in opportunitynumber ||TextInput3_5.Text in referenceid
     ),
     ID,
     SortOrder.Descending
     )
    )

     


    If this solves your question, would you be so kind as to accept it as a solution✔️

    If you liked my solution, please give it a thumbs up👍

     

    Connect with me: LinkedIn | Blog

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,070

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 608

Last 30 days Overall leaderboard