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:
  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard