Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

How to Filter List Box in Power Apps?

Filtering data and displaying the results in controls such as galleries and data tables is a regular task when dealing with Power Apps.

I was recently working with Power Apps List box control, where I needed to filter the SharePoint list data and display the result in a gallery control.

In this article, I will explain to you how to filter list box in Power Apps, including various examples like:

  • Power Apps filter list box using the SharePoint Choice field
  • Power Apps filter list box using the SharePoint Date field
  • Power Apps filter list box and search

How to Filter List Box in Power Apps

So, let’s start with filtering the Power Apps list box control with the scenarios below.

Power Apps filter list box using SharePoint Choice column

I have a SharePoint Online List named “Project Tracker“. This list contains the below fields.

Column NameData Type
Project NameThis is a Title column with a single line of text. I just renamed it to “Project Name”
DescriptionMultiple lines of text
Project StatusChoice
Start DateDate and time
End DateDate and time

Refer to the below screenshot:

filter powerapps listbox items

In Power Apps, there is a List box control and a Gallery control. The List box control has all the list choice values like All, In Progress, Not Started, and Completed.

The gallery will filter and show all records from the SharePoint list based on the user’s selections when they choose any value from the List box control.

Refer to the below image:

how to filter powerapps list box items

To achieve this, follow the instructions below:

1. Open Power Apps -> Create Power Apps canvas app -> Connect the SharePoint list [Project Tracker] to the app. Once you connect, it will look like the screenshot below.

filter power apps listbox items

2. Select the Power Apps Screen [ProjectTrackerScreen] -> Set its OnVisible property to the code below.

OnVisible = ClearCollect(
    colProjects,
    {Value: "All"}
);
Collect(
    colProjects,
    Distinct(
        'Project Tracker',
        'Project Status'.Value
    )
)

Where,

  • colProjects = Power Apps Collection
  • {Value: “All”} = Collection Item
  • Distinct() = This function can remove duplicate values from a data source
  • ‘Project Tracker’ = SharePoint Online List
  • ‘Project Status’.Value = SharePoint Choice Field Column Values
filter powerapps list box items

3. Next, insert a List box control [ListBox_ProjectStatus] -> Set its Items property as:

Items = colProjects

Where,

  • colProjects = Power Apps Collection
how to a filter powerapps listbox items

4. Insert a Gallery control and set its Items property as shown below:

Items = If(
    ListBox_ProjectStatus.Selected.Value = "All",
    'Project Tracker',
    Filter(
        'Project Tracker',
        'Project Status'.Value = ListBox_ProjectStatus.Selected.Value
    )
)

Where,

  • If() = This function helps us to evaluate multiple unrelated conditions
  • ListBox_ProjectStatus.Selected.Value = “All” = Power Apps List box name, and “All” is the collection item value