Showing results for 
Search instead for 
Did you mean: 
New Member

Use all items in a list to filter a gallery

Hello Power Apps community! I really need your help.


I need to filter a gallery using all the distinct values present in a list, allow me to elaborate:


I have a main database with the product, pricing and region information and a secondary database with region and country information, just as follows:

Main database:

Product A100US East Coast
Product A120US West Coast
Product A150US Gulf Coast


Secondary database (region_country referential):

US East CoastUS
US West CoastUS
US Gulf CoastUS


The users must input the country and obtain the products, prices and regions that apply to that country.


Today I am using multiple labels (11 total since there are countries that are a part of 11 regions), what happens is as following:

User inputs: US

Label1 = Last(FirstN(Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region),1)).Result

Label2 = Last(FirstN(Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region),2)).Result

Label3 = Last(FirstN(Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region),3)).Result

And then in the gallery:

Filter(Primary_Database, Region = Label1.Text || Region = Label2.Text || Region = Label3.Text) (goes up to 11)


My concern is that eventually more regions for a specific country will be introduced and I require a solution that doesn't need for me to create more labels and adding more OR statements in order to retrieve all the data.


Therefore, is there a way I can use ALL the items in a list to filter the Gallery?

I need the list to be distinct so something like = Distinct(Filter(Secondary_Database, Country = CountryInput.Text),Region) and then use all of the retrieved items to filter the gallery.


BTW the main database is over 10k lines but the secondary is around 1k.


I appreciate your support!




Super User
Super User

Hey! If you have 1 contry and many reagions you could create another combobox for user to choose the region.

You can filter the 2 dropdwon to only show regions from the cpuntry. If a country only has 1 region, the only one that appears is that. I have that filter in a app of mine, I can show you if u want


If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Hey Nogueira! 


The issue is that the user is oblivious to the regions, I need the result for the "US" input to be all of the products with their prices for all the regions that have US as part of their country. I can't have the users selecting the regions, as I mentioned before there are some countries that can have up to 11 regions associated. Imaging having the user select all of the regions each time they input a new country!!


Is there a way to have the application automatically select all available items in a combobox?


I appreciate your help!




Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,070)