top of page
Writer's pictureShane Young

Learn Different Ways to Filter a Power Apps Gallery

Updated: Jul 21

Welcome to a comprehensive guide on how to filter Power Apps galleries using various techniques. Whether you're working with Dataverse, SQL, SharePoint, Excel, or other data sources, understanding how to effectively filter data is crucial for creating dynamic and user-friendly applications. In this post, we'll explore different methods to filter your Power Apps gallery, complete with code snippets for each technique. Let's dive in!


Before we start, if you are looking for a guided approach to Filtering Galleries then you can also check out my video Do you know 10 ways you can filter a Power Apps gallery?

This 10-minute video shows all of the techniques shown below in action. I grabbed a screenshot from the video of each so you can see the examples different ways.


Filter Power Apps Gallery By Date and Date Range

Filtering by date allows users to view records from specific time periods. Here's how you can filter a gallery to show items based on a date or a date range:

// Filter by a specific date 
Filter(YourDataSource, ProjectDate = Today()) 
// Filter by a date range 
Filter(YourDataSource, ProjectDate >= DateValue("12/25/2024) && ProjectDate <= DateValue("12/31/2024"))

Video screenshot:

Filter Power Apps by Date

Filter Power Apps Gallery By User

Personalize your app by showing data relevant to the currently logged-in user. This method is particularly useful for task or project management apps:

// Filter by the current user's email 
Filter(YourDataSource, ProjectManagerEmail = User().Email)

In the video we show other things including using the Entra ID. Video screenshot:


Filter Gallery by User()

Filter Power Apps Gallery By Text Input and StartsWith

Allow users to search your gallery using text input. This can be refined using the StartsWith function for more dynamic searches:

// Filter by text input 
Filter(YourDataSource, TextColumn = TextInput1.Text) 
// Use StartsWith for partial matches 
Filter(YourDataSource, StartsWith(TextColumn, TextInput1.Text))

Video screenshot:


Filter Gallery by Text Input using the StartsWith function

Filter Power Apps Gallery By Dropdown and Radio Controls

Dropdowns and radio buttons are great for filtering galleries based on predefined criteria. They work exactly the same so you can replace Dropdown1 below with the name of your Radio control and get the same result:

// Filter by dropdown 
Filter(YourDataSource, StatusColumn = Dropdown1.Selected.Value) 
// Filter by radio button 
Filter(YourDataSource, CategoryColumn = Radio1.Selected.Value)

Video screenshot:

Filter Gallery by Dropdown or Radio control

Filter Power Apps Gallery By Combobox

Combo boxes allow for multi-selection, enabling users to filter based on multiple criteria simultaneously. Remember this can cause delegation challenges depending on your data source:

// Filter by combobox selections 
Filter(YourDataSource, StatusColumn in ComboBox1.SelectedItems.Value)
Filter Gallery by Combobox using the in operator

Filter Power Apps Gallery By Another Gallery

Use one gallery to filter another, creating a linked interactive experience:

// Filter based on selection in another gallery 
Filter(YourDataSource, CategoryColumn = Gallery1.Selected.Category)
Filter Gallery by another gallery

Filter Power Apps Gallery By Button

Buttons can dynamically set variables that can then be used to filter based on user interaction, offering a flexible way to manipulate gallery data:

// Set a variable on button press 
Button.OnSelect = Set(varFilterValue, "SpecificValue") 
// Use the variable to filter 
Filter(YourDataSource, ColumnName = varFilterValue)

Button:

Formula to set a context variable using a button onselect

Gallery:

Filter Gallery by a button using a variable

Filter Power Apps Gallery By Checkbox

Checkboxes offer a straightforward way to toggle filters for boolean (true/false) values. There are other chaotic filtering ideas with Checkboxes but they all end poorly. Also, remember Dataverse doesn't have a Boolean column, so this example is more SharePoint or SQL specific:

// Filter based on a checkbox 
Filter(YourDataSource, BooleanColumn = Checkbox1.Value)

Video screenshot from a different data souce:

Filter a gallery by a Checkbox

Understanding Data Sources: Dataverse, SQL, SharePoint, Excel, and More

When filtering data in Power Apps, it's important to consider the data source you're working with. Each data source, be it Dataverse, SQL, SharePoint, or Excel, has its nuances. For instance, Dataverse provides a robust platform with complex data types and relationships, making it ideal for enterprise-level applications. SQL databases offer powerful querying capabilities for apps requiring complex data operations. SharePoint is perfect for integrating with Microsoft 365 services, while Excel suits simpler applications with static data.


Remember, the syntax for filtering can vary slightly depending on the data source, especially when dealing with specific data types or when addressing delegation limits. Always test your filters to ensure they work as expected across different data sources.

By mastering these filtering techniques, you can significantly enhance the user experience and functionality of your Power Apps.


If you need help with your Power Apps, we are here for you. We offer everything from quick free help, to mentoring, all the way to full scale Power Platform projects. Just scroll down below and let us know how we can help you!


14,050 views0 comments

Comments


bottom of page