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 / Filter a form based on...
Power Apps
Answered

Filter a form based on the user butten selection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a gallery that I wish to show data from the excel that is stored on GoogleDrive. Gallery shoud be populated base on which button that the user selects. 

 

In Each OnSelect for the buttens I create a variable ex: Set(SupportDepartmentFilter, "All"), Set(SupportDepartmentFilter, "System Support" 

Then on the Items of Gallery I have this formula:

Sort(If(SupportDepartmentFilter="All",Filter(SubmissionForm, Employee = MyEmail), Filter(SubmissionForm, SupportDepartment=SupportDepartmentFilter&& Employee = MyEmail) ), UniqueID, Ascending)

 

However, the gallery is not showing any data. 

 

Thank you 🙂 

screenshot.PNG
Categories:
  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    I think the issue here might be caused by the fields not matching correctly.

    Could the Button be switched to a Dropdown control? Which then could be built based on the data within the List.

     

    Please take a try with the steps below:

    1. Under the OnVisible property of the first screen, enter the following:

     

    Collect(ClearCollect(DataCollection,{Result:"All"}),Distinct(SubmissionForm,SupportDepartment))

    The formula above would collect all the available Department contains within the list, together with the All status, 

     

    2. Add a dropdown control, under the items property, enter the following:

    DataCollection

    Dropdown item would be set to the one collected previously,

     

    3. under the Items property of the Gallery, switch the formula as below:

    If(Dropdown1.Selected.Value="All",
    SortByColumns(Filter(SubmissionForm, Employee = MyEmail), UniqueID, Ascending),
    SortByColumns(Filter(SubmissionForm, SupportDepartment=Dropdown1.Selected.Value, Employee = MyEmail) ), UniqueID, Ascending)
    )

    Then within the Gallery, filter the list with the proper condition (Dropdown.selected.value).

     

    Let me know if this would work.

     

    Regards,

    Michael

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Michael, (@ )

     

    Thank you so much for your descriptive answer. It works perfectly.

    Also, May I know why we cannot use buttons?  

     

     

    Kind Regards, 

     

    Fatemah. 

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    Glad that helps, and if convenient, please consider accept it as the solution to help the others who may have the same question.

     

    Actually I am not very sure about the cause, I suspect the reason that the filter not working should be the string mis-match, as the variable saved might be different from the acutal data stored in the List.

    Using the Distinct() function would just keep the data format the same as the data source, which should be able to meet the ' = ' usage.

     

    Regards,

    Michael

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-micsh-msft, 

     

    I am actually using part of a template that is available in PowerApps. Leave Request template. In template, Collection is begin used instead of an external data scource. So I was thinking it is possible to do so. 

     

    Thank you, 

    Kind Regards, 

     

    Fatema

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard