Ova

How to Create a Multi-Select Dropdown in Power Apps

Published in Power Apps Controls 4 mins read

Creating a multi-select dropdown in Power Apps is most effectively achieved using the Combo box control. This versatile control allows users to select multiple items from a list, providing an intuitive and clean interface. When you preview your app, the Combo box will list out all available choices, enabling the user to make multiple selections directly within the dropdown.

Utilizing the Combo Box Control for Multi-Select

The Combo box control is specifically designed for scenarios where users need to pick one or more items from a predefined list.

Steps to Implement a Multi-Select Combo Box:

  1. Add a Combo Box:

    • From the Insert tab, go to Input and select Combo box. Place it on your screen.
  2. Configure the Items Property:

    • This property defines the data source for your dropdown. It can be a collection, a data source (like SharePoint list, Dataverse table), or a static table.
    • Example 1 (Static Table):
      ["Apple", "Banana", "Cherry", "Date", "Elderberry"]
    • Example 2 (SharePoint List Column):
      Choices([YourSharePointList], 'ColumnName')
    • Example 3 (Distinct values from a data source):
      Distinct(YourDataSource, YourColumnName)
  3. Enable Multi-Select:

    • Select the Combo box control. In the Properties pane on the right, locate the SelectMultiple property and set it to true. This is crucial for enabling multiple selections.
  4. Define DisplayFields and SearchFields (Optional but Recommended):

    • If your Items property is a table with multiple columns, use DisplayFields to specify which column(s) should be shown to the user in the dropdown.
    • Use SearchFields to define which column(s) the user can type into to search for items.
    • Example: If your Items are from a table with ID and Title columns:
      • DisplayFields: ["Title"]
      • SearchFields: ["Title"]
  5. Set DefaultSelectedItems (Optional):

    • Use this property to pre-select items when the app loads. This should be a table of items that match your Items property structure.
    • Example:
      Table({Value: "Apple"}, {Value: "Banana"}) // For static string items
      LookUp(YourDataSource, ID = 1) // For a specific record from a data source

Retrieving Selected Values

Once users make their selections, you'll often need to access these values for further processing, such as filtering a gallery or saving to a data source.

  • ComboBoxName.SelectedItems: This property returns a table of all the items the user has selected. Each item in this table will have the same schema as your Items property.
    • Example: ComboBox1.SelectedItems might return [{Value: "Apple"}, {Value: "Cherry"}].
  • ComboBoxName.Selected.Value: This property is typically used for single-select scenarios or when you want to extract a specific column from the Selected item in a single-select context. For multi-select, SelectedItems is preferred.

Practical Applications: Filtering a Gallery

A common use case for multi-select dropdowns is to filter the contents of a gallery based on user selections. For the Items property of the gallery, you will filter based on the ComboBox.SelectedItems.

Example: Filtering a gallery named Gallery1 that displays products, using a Combo box named ComboBox1 where ComboBox1.Items is a list of product categories:

Filter(
    ProductsDataSource,
    IsEmpty(ComboBox1.SelectedItems) || // Show all if nothing is selected
    'ProductCategory' in ComboBox1.SelectedItems.Value // Filter by selected categories
)

In this example:

  • ProductsDataSource is your collection or data source for the gallery.
  • 'ProductCategory' is the column in ProductsDataSource that you want to filter by.
  • ComboBox1.SelectedItems.Value refers to the table of selected category values from your Combo box.
  • IsEmpty(ComboBox1.SelectedItems) ensures that if no items are selected in the Combo box, the gallery shows all products (no filter applied).

Key Combo Box Properties for Multi-Select

Here's a quick reference for the most important properties when setting up a multi-select Combo box:

Property Description Common Value/Setting
Items The data source for the list of available choices. ["Red", "Blue"], Choices(List, 'Column'), Distinct(...)
SelectMultiple Enables or disables multiple item selection. true
DisplayFields Specifies which fields from Items are shown in the dropdown list. ["Title"], ["Name", "Code"]
SearchFields Specifies which fields from Items are used for searching. ["Title"]
DefaultSelectedItems A table of items that are pre-selected when the control loads. Table({Value: "Option1"})
SelectedItems Returns a table of all items currently selected by the user. (Read-only) ComboBox1.SelectedItems

Tips for Enhanced User Experience

  • Clear Selection Button: Add a button with Reset(ComboBox1) to allow users to quickly clear all selections.
  • Search Functionality: Ensure SearchFields is configured for large lists to help users find items quickly.
  • Placeholder Text: Set the PlaceholderText property to provide instructions, e.g., "Select categories..."

By following these steps, you can effectively implement a multi-select dropdown in your Power Apps, significantly enhancing user interaction and data filtering capabilities.