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 / How can I Sort AND Fil...
Power Apps
Answered

How can I Sort AND Filter a Gallery in PowerApps?

(0) ShareShare
ReportReport
Posted on by 39

Hello everyone,

 

I'm having some trouble getting the right formula to Sort AND Filter a Gallery in PowerApps.

 

Here is an example of a Filter Gallery I have created:

 

1.png

 

Here is an example of a Sort Gallery I have created:

 

2.png

 

 

The name of the SharePoint list is 'Overseas Travel Log'. I am trying to create a formula that merges both the Sort and Filter together. They work separately, but not together.

 

What I want is a formula that filters by user (first formula) and shows the newest (creation) date first (second formula). The first image is what I want, however the dates are shown oldest - newest. I'd essentially like this reversed so it shows the newest result first, as shown in the second image.

 

I hope this is enough context 🙂

 

I did look online, which suggested I do this: 'Sort(Filter(DataSource, FilterCondition), SortColumn, SortOrder)', but this hasn't worked:

 

 

3.png

 

 

 

Thanks all for your help 🙂

 

Katie.

Categories:
I have the same question (0)
  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Hi @KatieGrantBAS,

     

    Your code looks almost correct, but instead of Sort you want SortByColumns

    Try SortByColumn(Filter(DataSource, FilterCondition), SortColumn, SortOrder)

  • KatieGrantBAS Profile Picture
    39 on at

    Hi there,

     

    Thank you for your speedy response! I tried changing Sort to SortByColumns, however it doesn't appear to have worked 😞 I wonder if there's something really small and niggly i'm doing wrong here. 

     

    4.png

  • Verified answer
    Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Hi @KatieGrantBAS,

     

    Yeah, looking at the code you've provided it doesn't look quite right, as it doesn't look like you've closed the Filter before entering the Sort commands. Try this instead. I've bolded the brackets related to the Filter function.

     

    SortByColumns(Filter('Overseas Travel Log', 'Person Travelling Email' = User().Email, 'Date Form Created' <= Today()), 'ID', SortOrder.Descending)

  • KatieGrantBAS Profile Picture
    39 on at

    You're a legend!!! This worked 🙂

     

    Thank you so much for your help. I really appreciate it.

     

    Thank you!!!

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    Fantastic, glad it helped 😄

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard