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 wi...
Power Apps
Answered

Filtering a gallery with a global variable

(0) ShareShare
ReportReport
Posted on by 46

Hi everyone,

 

I have a gallery which shows the name and the school number. I also have a global variable with the number of the school where the user works.  So I would like to show only the rows where those  school numbers match.

 

I thought use a Filter function in the property ITEMS of the gallery, however it does not work.

 

Filter(Declarations; variableCompanyNumber=Gallery2.Subtitle2)

 

Declarations is the name of  my the Sharepoint list data source.

 

What should I do? Thanks in advance

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    Consider this formula on the Items property of the Gallery;

    Filter(Declarations,SchoolNumber column=variableCompanyNumber)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • tguihur Profile Picture
    46 on at

    I tried it but it says :

     

    Invalid argument type

     

    GalleryPowerApps.PNG

  • eka24 Profile Picture
    20,923 on at

    Please show the formula for the variable in a screenshot

    Also indicate the error message

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

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

    Hi @tguihur ,

    Could you tell me:
    1)how do you set this variable variableCompanyNumber?
    2)the data type of SchoolNumber column?

    3)what does "Gallery2.Subtitle2" represent?

    I assume that :

    gallery2 is this gallery's name, Subtitle2 is the control that you use to display SchoolNumber column.

    So do you want to filter list that SchoolNumber column=variablevalue and display in gallery2?

    If so, you need to make sure the data type of SchoolNumber column and the variable is the same.

    Please try this:

    Filter(Declarations;Value(SchoolNumber column)=Value(variableCompanyNumber))

     

     

    Best regards,

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 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard