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 Apps
Answered

Sort Gallery

(0) ShareShare
ReportReport
Posted on by 125

Hello Folks,

 

I have a column that have multiple status and I need to sort them not alphabetical

 

here's the current sort

 

Returned

Open

In Progress

Fulfilled

 

the requirements it should sort

 

In Progress

Returned

Open

Fulfilled

Categories:
I have the same question (0)
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    You can pass a "sort order table" to the SortByColumns function, and that will determine how the items are sorted. For example, if you have a collection defined as

    ClearCollect(
     myItems,
     { Name: "Item 1", Status: "Returned" },
     { Name: "Item 2", Status: "Open" },
     { Name: "Item 3", Status: "Returned" },
     { Name: "Item 4", Status: "In Progress" },
     { Name: "Item 5", Status: "Fulfilled" },
     { Name: "Item 6", Status: "Open" },
     { Name: "Item 7", Status: "Returned" },
     { Name: "Item 8", Status: "In Progress" });

    Then the following expression will sort the items according to your requirement:

    SortByColumns(
     myItems,
     "Status",
     ["In Progress", "Returned", "Open", "Fulfilled"])

    See the screenshot below for an example of a gallery with this expression:

    ForumPost001.png

    Hope this helps!

  • philifova Profile Picture
    125 on at

    Hello @CarlosFigueira 

     

    How can I combine this with filter?

  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    You can filter the collection prior to sorting it. See the modified code below for an example:

    SortByColumns(
     Filter(myItems, EndsWith(Name, "2")),
     "Status",
     ["In Progress", "Returned", "Open", "Fulfilled"])

    Hope this helps! 

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard