Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

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.

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at
    Re: How can I Sort AND Filter a Gallery in PowerApps?

    Fantastic, glad it helped 😄

  • KatieGrantBAS Profile Picture
    23 on at
    Re: How can I Sort AND Filter a Gallery in PowerApps?

    You're a legend!!! This worked 🙂

     

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

     

    Thank you!!!

  • Verified answer
    Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at
    Re: How can I Sort AND Filter a Gallery in PowerApps?

    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
    Re: How can I Sort AND Filter a Gallery in PowerApps?

    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

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at
    Re: How can I Sort AND Filter a Gallery in PowerApps?

    Hi @KatieGrantBAS,

     

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

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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard