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 / Filtering a gallery by...
Power Apps
Answered

Filtering a gallery by category

(0) ShareShare
ReportReport
Posted on by 12

I am trying to create button functionality that filters a gallery of questions by category. I need to be able to filter to the next category each time the button is selected.

 

the main filter items property to start the gallery is:  Filter(QuestionCol,Category=varCategory), QuestionCol)

varCategory is established by starting the gallery from a main screen.

 

I then would like to use a button to filter the gallery to the next category of questions.  The category and questions are set up like so:

Category 1= 5 questions

Category 2=8 questions

Category 3= 9 questions

etc...

 

Any help would be appreciated.  I believe the answer lies in creating a new variable for the next category of questions but not sure how to execute it.

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

    @ABralln You can have another variable to see which category you are in now. In the beginning it will be,

    Set(varCurrentCategory,1)

    Add a Button saying Next. In the OnSelect, 

    Set(varCurrentCategory,varCurrentCategory+1);

    Switch(varCurrentCategory,

    1, Set(varCategory="Category 1",

    2, Set(varCategory="Category 2",

    3, Set(varCategory="Category 3",

    ....

    )

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • ABralln Profile Picture
    12 on at

    Thanks CNT, I tried the solution but am getting an invalid number of arguments with this part.

    1, Set(varCategory="Category 1",

    2, Set(varCategory="Category 2",

    3, Set(varCategory="Category 3",

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @ABralln Close brackets ) are missing 

    1, Set(varCategory="Category 1"),

    2, Set(varCategory="Category 2"),

    3, Set(varCategory="Category 3"),

  • Verified answer
    ABralln Profile Picture
    12 on at

    Thanks CNT, I messed around with it and after removing the "=" it worked, I added a new filter expression, and it works great.

     

    Switch(varCurrentCategory,

    1, Set(varCategory,"Category 1"),

    2, Set(varCategory,"Category 2"),

    3, Set(varCategory,"Category 3)",

    ....

    );Filter(QuestionCol,Category=varCategory))

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard