How to Filter Power Apps Gallery By Dropdown?

Are you interested in learning the Power Apps filter gallery by dropdown control? Well! In this Power Apps tutorial, I will show you how to filter Power Apps Gallery by dropdown.

Here, we will discuss how to filter a Power Apps gallery by dropdown choice field and filter a Power Apps gallery by dropdown all items.

Also, we will learn the Power Apps filter gallery by dropdown date and how to filter a Power Apps gallery by dropdown and search.

Power Apps Filter Gallery By Dropdown [Choice Field]

Here, we will see how to filter a Power Apps gallery by dropdown based on the SharePoint list choice field.

Example:

1. 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
Power Apps Filter Gallery By Dropdown

2. In Power Apps, there is a Gallery control and a Dropdown control. The dropdown control has values like All, In Progress, Not Started, and Completed.

3. When a user selects any value from the dropdown, the gallery will display each record from the SharePoint list based on the selected dropdown choice field.

Refer to the screenshot below:

Power Apps Filter a Gallery By Dropdown Choice Field

To achieve the above example, follow the below-mentioned steps. Such as:

4. 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.

Power Apps Gallery Filter By Dropdown

5. Then, select a 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
Power Apps Gallery Filter By Dropdown Choice Field

6. Next, insert a Dropdown control [drp_ProjectStatus] -> Set its Items property as:

Items = colProjects

Where,

  • colProjects = Power Apps Collection
How to Filter Power Apps Gallery By Dropdown

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

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

Where,

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

Refer to the below image:

How to Filter Power Apps Gallery By Dropdown Choice Field

8. Save, Publish, and Preview the app. When the user selects a specific value from the dropdown control, the gallery will display the filtered records, i.e., [Completed Projects], as in the screenshot below.

How to Filter a Power Apps Gallery By Dropdown Choice Field

This is how to filter a Power Apps gallery by dropdown choice field.

Power Apps Filter Gallery By Dropdown Date

Next, we will discuss how to filter a Power Apps gallery by dropdown date.

Example:

1. I have a SharePoint Online list named “Training Courses“. This list contains the below fields.

Column NameData Type
Course NameThis is a Title column with a single line of text. I just renamed it to “Course Name”
DescriptionMultiple lines of text
Course Start DateDate and time
Course End DateDate and time
Power Apps Filter Gallery By Dropdown Date

2. In Power Apps, there is a Horizontal gallery control; this gallery displays each record from the SharePoint list based on the dropdown selected date.

Power Apps Gallery Filter By Dropdown Date

To work around the above example, follow the below steps.

3. On the Power Apps -> Connect the SharePoint list, i.e., [Training Courses] to the app. Once you connect, it will look like the screenshot below.

How to Filter Power Apps Gallery By Dropdown Date

4. Insert a Dropdown control and set its Items property as:

Items = Distinct(
    'Training Courses',
    'Course Start Date'
)

Where,

  • ‘Training Courses’ = SharePoint Online List
  • Course Start Date’ = SharePoint Date Field
How to Filter a Power Apps Gallery by Dropdown Date

5. Then, insert a Gallery control and set its Items property as:

Items = Filter(
    'Training Courses',
    'Course Start Date' = drp_TrainingCourses.Selected.Value
)

Where,

  • ‘Training Courses’ = SharePoint Online List
  • drp_TrainingCourses = Power Apps Dropdown Name
Power Apps Gallery Filter Using Dropdown Date

6. Save, Publish, and Preview the app. Select any particular date from the dropdown control, and then the gallery will filter and display the records based on the dropdown-selected date.

Power Apps Filter Gallery Using Dropdown Date

This is how to filter a Power Apps gallery by dropdown date.

Power Apps Filter Gallery By Dropdown and Search

Let’s see how to filter a Power Apps gallery by dropdown control based on the search.

Example:

1. I will also take the same SharePoint Online list [Training Courses] for this example.

2. In Power Apps, there is Gallery control, Text input, and Dropdown control. This gallery displays each record from the SharePoint list based on the dropdown control and search results.

3. Also, I faced a delegation warning [Yellow triangle], as in the screenshot below. The warning message appears as “Delegation warning. The “Search” part of this formula might not work correctly on large data sets.

Refer to the below screenshot:

Power Apps Filter Gallery By Dropdown and Search

4. To overcome this Power Apps delegation warning, I have created a Power Apps collection [colCourses] using my SharePoint list. Then, I filter a Power Apps gallery by dropdown without delegation warning like below.

Power Apps Gallery Filter By Dropdown and Search

To achieve this example, follow the below steps. Such as:

5. On the Power Apps canvas app -> Select App object and set its OnStart property as:

OnStart = ClearCollect(
    colcourses,
    'Training Courses'
)

Where,

  • colcourses = Power Apps Collection Name
  • ‘Training Courses’ = SharePoint Online List
Power Apps Filter a Gallery by Dropdown and Search

6. Insert a Text input, make its Default property blank [“”], and set its Hint text property as “Search Course Name” like below.

How to Filter Power Apps Gallery By Dropdown and Search

7. Then, insert a Dropdown control and set its Items property as:

Items = Distinct(
    colcourses,
    'Course Start Date'
)

Where,

  • colcourses = Power Apps Collection
  • ‘Course Start Date’ = SharePoint Date Field
How to Filter a Power Apps Gallery By Dropdown and Search

8. Next, insert a Gallery control and set its Items property to the code below:

Items = Search(
    Filter(
        colcourses,
        'Course Start Date' = drp_Courses.Selected.Value
    ),
    txt_Search.Text,
    "Title"
)

Where,

  • Search() = This function allows users to search for and filter items in a Power Apps gallery
  • drp_Courses = Power Apps Dropdown
  • txt_Search.Text = Power Apps Text input
  • “Title” = SharePoint Text column
Power Apps Gallery Filter By Search and Dropdown

9. Save, Publish, and preview the app. This gallery will display the filtered records based on the search results and selected dropdown value as in the screenshot below.

Power Apps Filter Gallery By Search and Dropdown

This is all about how to filter a Power Apps gallery by dropdown and search.

Conclusion

This Microsoft Power Apps tutorial taught us all about the Power Apps filter gallery by dropdown.

Here, I explained how to filter a Power Apps gallery by dropdown choice field and how to filter a Power Apps Gallery by dropdown date. Also, we discussed the Power Apps filter gallery by dropdown and search.

You may like the following tutorials: