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 / Add button for sortbyc...
Power Apps
Answered

Add button for sortbycolum in a gallery

(0) ShareShare
ReportReport
Posted on by 75

Hi Everyone, 

there's any posibility to create a button to filter a gallery by any condition ? 
How It's possible ? 

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @RodrigoSifon  You have "Sort by" in your subject, but you're asking about a Filter. Which one are you trying to do?

  • Verified answer
    hthpowerapper Profile Picture
    364 Super User 2024 Season 1 on at

    Yes, it is possible to add a single or multiple filters a gallery using a button in Power Apps. I usually accomplish this using variable and setting the Items property to be filtered based on the variable. Rough overview

    1. Add a button to your screen.
    2. Set the OnSelect property of the button to update a variable. The variable should hold the condition you want to filter the gallery by. For instance, if you want to filter the gallery to only show items where a Status field is Open, you might use something like this: Set(varAscending, !varAscending). This will change varAscending from true to false, or from false to true, every time the button is clicked.
    3. Set the Items property of the gallery to a formula that applies the filter based on the variable. Continuing the example above, you might use something like this: If(varAscending, Sort(YourDataSource, YourColumn, Ascending), Sort(YourDataSource, YourColumn, Descending))

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard