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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How can I Sort AND Fil...
Power Apps
Unanswered

How can I Sort AND Filter a Gallery in PowerApps?

(0) ShareShare
ReportReport
Posted on by 23

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
    23 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
    23 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard