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 / Using a button to filt...
Power Apps
Answered

Using a button to filter a gallery

(0) ShareShare
ReportReport
Posted on by 209

Hello,

 

Is there a way I can use a button to filter some results in my gallery based on an output of a label.  There is a label in my gallery which holds a text output if another argument is true.  The text output held by the label is "CAB".  I need to be able to press a button and for all of the labels with the "CAB" value to be displayed.  Is there a way of doing this? (Sorry I'm new to Powerapp design)

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

    Hi @Station1901,

    There is certainly a way to do what you are trying to do.  It could be done using the UpdateContext() function and would be based on the formula that you use to derive the Text property of your label. Please let me know this formula and I can proceed. 

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Station1901,

    Do you want to filter your Gallery items based on an output of a label when you click a button?

    I have made a test on my side, please take a try with the following workaround:

    Set the OnVisible property of the first screen of your app to following:

    ClearCollect(RecordsCollection, 'YourDataSource')

    or

    ClearCollect(RecordsCollection, 'The formula you typed within the Items property of your Gallery control') /* <-- Save your Original Gallery items into a Collection */

    Set the Items property of your Gallery control to following:

    RecordsCollection

    Set the OnSelect property of the Button control (that you clicked) to following formula:

    ClearCollect(
     RecordsCollection,
     Filter(RecordsCollection,FilteredColumn=Label1.Text)
    )

    Note: The FilteredColumn represents the column in your data source, which you want to filter your Gallery items based on. The Label1 represents the Label control that you mentioned.

     

    More details about the Filter function in PowerApps, please check the following article:

    Filter function

     

    Best regards,

    Kris

  • Aimeerosemulls Profile Picture
    Microsoft Employee on at

    hey @v-xida-msft,

     

    Is it still possible to use this if the column in sharepoint I am filtering on is a choice column?

     

    Thanks,

    Aimee

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard