Power Apps Gallery Filter [With Real Examples]

In this Power Apps tutorial, we will learn about the Power Apps gallery filter and how to use it to filter the data in various Power Apps gallery scenarios. We will also cover the following topics, such as:

  1. Power apps gallery filter
  2. Power Apps Gallery Filter YesNo
  3. power apps gallery filter by the current user
  4. power apps gallery filter with dropdown
  5. powerapps filter gallery by text inputs
  6. power apps gallery filter combo box
  7. powerapps filter gallery by date
  8. powerapps filter gallery by date range
  9. power apps gallery filter by year
  10. power apps gallery filter by month or radio button
  11. Power Apps filter gallery by the date picker
  12. Power Apps filters the gallery by multiple dropdowns.
  13. Power Appsgallery filter with a button
  14. Power apps filter gallery with multiple buttons
  15. Power apps gallery filter contains()
  16. powerapps filter gallery startswith()
  17. Power Apps gallery filters multiple conditions or criteria.
  18. Power Apps filter gallery descending
  19. Power Apps filter gallery Ascending
  20. Power Apps filter gallery last 7 days
  21. Power Apps filter gallery lookup
  22. Power Appsilter gallery multiple combo boxes
  23. How to filter a gallery by not equals in Power Apps?
  24. How to filter a gallery by blank items in the Power Apps gallery?
  25. How to filter a gallery that shows all the items?
  26. How to create a distinct gallery on Power Apps?
  27. How to filter a gallery that does not empty or hide the empty items?
  28. How to filter a gallery by another gallery on Power Apps?
  29. How to filter a gallery with a search function on Power Apps?
  30. How to filter a gallery with multiple checkbox selections on Power Apps?
  31. How to filter a Power Apps gallery by field value?
  32. How to filter a gallery by a people picker column on Power Apps?
  33. How to filter a gallery by ID on Power Apps?

Power Apps Gallery Filter

So in our previous article, we discussed Power Apps gallery control. Before starting this, follow the link and understand the Power Apps gallery control as well as how to create a gallery in Power Apps.

The PowerApps filter function enables you to create and deploy a search box with dynamic data filtration. You can use PowerApps to search through data tables and galleries for specific records that meet a set of criteria.

User can filter their data as per their requirements. The syntax for the filter() is:

Filter (Source, logical_test,...)

In our coming examples, we will see how to use this filter() within the Power Apps gallery.

Also Read: Power Apps Gallery Patch [With Various Examples]

Power Apps Gallery Filter YesNo

Let’s see how to work with the YesNo SharePoint field and filter the data within the Power Apps gallery. In the Power Apps gallery, the yes/no SharePoint fields appear as boolean values i.e., true and false.

We have a SharePoint list named ‘Product‘ with some random data and a ‘YesNo‘ column, i.e., Delivered.

power apps gallery filter yesNo
power apps gallery filter yes no
  • By using the above Sharepoint list, let’s create a Power Apps gallery. To create this the following steps are:
    • Sign in to the Power Apps with your Office365 User ID.
    • Navigate to ‘+Create’ > Blank app > Blank canvas app > Create.
    • Give the app a name and select a format, whether mobile or tablet. (In our case, we’ll go with the tablet format).
    • Create.
    • On the Power App screen, add a gallery. Go to the ‘Insert’ tab > Gallery > Choose any type. (Ex- Blank vertical gallery).
    • On the right-hand side Properties Panel, click on ‘Layout‘ and select the ‘Title‘.
    • Next, select the data source. Search ‘SharePoint‘ under the connector.
    • Choose your Site address. Then select the list name i.e., Product.
    • Connect.

It will show all the product’s titles on the Power Apps gallery. We have added 2 more labels to the gallery to show the data of the Order date and delivered column. Also, added a header to the gallery, to give it a new look like below. This is what the entire gallery looks like:

Power Apps Gallery Filter on YesNo field
Power Apps Gallery Filter on YesNo field
  • Now we will convert this boolean value from a true or false value into a yes or no value.
  • To do this, select the label that holds delivered data and insert the below expression in the ‘Text‘ property:
Text = If(ThisItem.Delivered, "Yes", "No")
Power Apps Gallery Filter YesNo column
Power Apps Gallery Filter YesNo column

The above gallery displays all of the records. Now we insert an expression to filter and display the records that were not delivered. To accomplish this, we will add a check box control to the Power Apps screen.

When the check box is checked, it displays the undeliverable items; when it is unchecked, it displays all of the records. To put this into action, take the following steps:

  • Go to the Insert tab > Input > Checkbox. Place it beside the gallery.
  • Give a text to the checkbox on the ‘Text‘ property i.e., Show Not Delivered.
Gallery Filter YesNo in Power Apps
Gallery Filter YesNo in Power Apps
  • Select the gallery, and insert the below expression in the ‘Items‘ property to filter the data as per the requirement.
Items = Filter(Product, Delivered= CheckBoxControl.Value Or CheckBoxControl.Value = false)

Where,

  • Product – The name of the data source
  • CheckBoxControl – The name of the check box
Filtering records by yesno columns Power Apps
Filtering records by yesno columns Power Apps

Let’s save, publish, and preview the app. We can see the data got filtered when we checked the check box.

Properly filter SharePoint YesNo column in Power Apps
Properly filter the SharePoint YesNo column in the Power Apps gallery.

This is how to filter the SharePoint Yes/No column in the Power Apps gallery.

Also, Read: Power Apps Data Table [Complete Guide]

Power Apps gallery filter by the current user

In this section, we will see how to filter a gallery by the current user within the Power Apps. Suppose, we have prepared a Power Apps gallery using the SharePoint list named “Projects” with some random data.

power apps gallery filter by current user
power apps gallery filter by the current user
  • To filter the data by the current user, insert the below expression in the ‘Items‘ property of the gallery.
Items = Filter(Projects, User().FullName = ProjectHandler.DisplayName)

Where,

  • Projects – The name of the data source
  • ProjectHandler – The name of the SharePoint people column
power apps filter gallery by current user
power apps filter gallery by the current user

Since “Sonam Subhadarsini” is the current user, the data was filtered to reflect this user. This is how to filter the data by the current user within the Power Apps gallery.

Check: Power Apps Radio Button

Power Apps gallery filter with dropdown

Here, we will see how to filter a Power Apps gallery using a dropdown control. For this, we have prepared a Power Apps gallery using a SharePoint list named ‘Bikesales‘ that contains a choice column i.e., Payment mode.

power apps gallery filter with dropdown
power apps gallery filter with dropdown
  • Let’s add a dropdown control to the Power Apps screen that contains payment mode options. As a result, when the user selects a payment method, the item details will be displayed based on the dropdown selection.
  • Go to the Insert > Inputs > Dropdown. Place it on top of the gallery.
  • Select the dropdown and insert the below expression in the ‘Items‘ property.
Items = Choices(BikeSales.'Payment Mode')

Where Payment Mode is the name of the SharePoint choice column. By using the above expression, it will show all the choices in the dropdown control.

powerapps filter dropdown items from SharePoint list
powerapps filter dropdown items from the SharePoint list
  • Next, select the gallery, and insert the below formula in the ‘Items’ property to filter the data as per the dropdown.
Items = Filter(BikeSales,'Payment Mode'.Value = Payment_Dropdown.Selected.Value)

Where,

  • Payment Mode – The name of the SharePoint choice column
  • Payment_Dropdown – The name of the dropdown control
powerapps filter gallery based on dropdown
powerapps filter gallery based on dropdown

When we apply the formula, it will display the filtered data based on the dropdown in the Power Apps gallery. Similarly, if we select the option ‘Advanced Payment‘, then the data will appear based on the dropdown.

Filter Gallery based on dropdown selection on Power Apps
Filter Gallery based on dropdown selection on Power Apps

This is how to filter the gallery based on dropdown selection on Power Apps.

Check: PowerApps stuck on getting your data

Power Apps filter gallery by text input

Similarly, here we will see how to filter a gallery by the text input. When the user inserts any text or bike name into the text input, then the data will be filtered as per the text input and filtered data will appear in the Power Apps gallery.

To accomplish this, we will return to the previous Power Apps gallery and use the SharePoint ‘Bike Sales‘ list as the data source, with the following steps:

  • On the Power Apps screen, add a text input and place it top of the gallery. Navigate to the Insert tab > Inputs > Text Input.
  • Select the gallery, and insert the below expression within the Items property to filter the gallery as per the text input.
Items = Filter(BikeSales,TextInputControl.Text in Title)

Where,

  • BikeSales – The name of the SharePoint list
  • TextInputControl – The name of the text input control name
  • Title – The name of the SharePoint list column
powerapps filter gallery the text input
powerapps filter gallery the text input

Let’s save, publish and play the app. We can see, that when we insert a text in the text input, the filtered data will be displayed in the Power Apps gallery. Suppose, we will insert ‘Harley‘ in the text input and the will come like below:

powerapps gallery filter the text input
powerapps gallery filter the text input
  • Also, we can see when the text input is empty, it will show all the data in the Power Apps gallery like below.
powerapps filter gallery by text input
Power Apps filter gallery by text input

This is how to filter the Power Apps gallery by text input.

Read: Power Apps in SharePoint

Power Apps gallery filter combo box

In this section, we’ll look at how to use a combo box to filter a Power Apps gallery. When a user selects an item or items from the combo box, the items in the Power Apps gallery are filtered, and the gallery only displays the filtered items.

Let’s take the previous Power Apps gallery that contains the SharePoint ‘BikeSales’ list to implement this requirement. To enforce our requirement, the following steps are:

  • On the Power Apps screen, add a combo box control and place it on top of the gallery. Navigate to the ‘Insert’ tab > Inputs > Combo box.
  • Select the combo box control and insert the below expression into the items property.
Items = Choices(BikeSales.'Payment Mode')

Where,

  • BikeSales – Then name of the data source.
  • Payment Mode – The name of the SharePoint choice column.
power apps gallery filter combo box
power apps gallery filter combo box
  • To filter the gallery as per the combo box selecting item(s), select the gallery and insert the below expression on the ‘Items‘ property of the gallery.
Items = Filter(BikeSales,'Payment Mode'.Value in ComboBoxControl.SelectedItems.Value)

Where,

  • ‘Payment Mode’. Value– To specify the choice column need to use ‘.Value’.
  • ComboBoxControl-The name of the combo box control
power apps filter gallery combo box
power apps filter gallery combo box

In the above gallery, we can see the item got filtered as per the combo box selection. Let’s save, publish, and preview the app.

Select multiple items in the combo box control, such as Instant Payment and Advance Payment. We can see the filtered data below:

How to Filter a Gallery using a Combo Box
How to Filter a Gallery using a Combo Box

This is how to filter a Gallery using a Combo Box in Power Apps.

Also, check: Power Apps SharePoint Button

Power Apps filter gallery by date

Let us see how to filter a Power Apps gallery by date. We are going to use the previous Power Apps gallery where we have added another SharePoint Date column like below:

powerapps filter gallery by date
Power Apps filter gallery by date

Now we’ll filter the above gallery by date, which means it’ll only show data whose sold date is less than today’s date. Because the current date is 8/5/2022, it will only display data whose sold date is earlier than today.

To do this, insert the below expression into the ‘Items‘ property of the Power Apps gallery.

Items = Filter(BikeSales, SoldDate < Date(2022,8,5))

Where,

  • BikeSales – The name of the SharePoint data source list
  • SoldDate – The name of the SharePoint date column
powerapps gallery filter by date
powerapps gallery filter by date

Once the formula is applied to the gallery, it will instantly filter the data as per the date. This is how to filter a powerapps gallery by date.

Also check: Power Apps Gallery Group By [With Real Examples]

Power Apps filter gallery by date range

Here, we will see how to filter a Power Apps gallery by a particular date range. Suppose, we have a SharePoint list named ‘Product‘ that has 2 date columns such as Order Date and delivery date.

Now, we will create a Power Apps gallery using that SharePoint list so that we can use this gallery to filter it by date range.

powerapps filter gallery by date range
powerapps filter gallery by date range

Let’s filter this by date range, which means that when a user selects specific date ranges from order date to delivery date, the data will be filtered according to those dates.

To do this, the following steps are:

  • On the Power Apps, Let’s insert a date picker into the screen and place it beside the gallery. By default, it will show the current date.
  • Go to the ‘Insert’ tab > Input > Date picker > Select it.
powerapps gallery filter by date range
Powerapps gallery filter by date range
  • Select the gallery and insert the below formula on the ‘Items‘ property.
Items = Filter(Product, OrderDate = OrderDatePicker.SelectedDate)

Where,

  • Product – The name of the SharePoint data source
  • OrderDate – The name of the SharePoint date column
  • OrderDatePicker – The name of the date picker input
Power Apps Filter A Gallery By Date Range
Power Apps Filter A Gallery By Date Range
  • Similarly, insert another date picker into the screen. This date picker will be used to insert the delivery date.
powerapps filter gallery by date picker
powerapps filter gallery by the date picker
  • Again, select the gallery control and insert the below expression to filter the gallery by the given date range. Select the gallery and insert the expression in the ‘Items‘ property.
Items = Filter(Product, OrderDate >= OrderDatePicker.SelectedDate && DeliverDate<= DeliverDatePicker.SelectedDate)

Where,

  • DeliverDate – The name of the second date column of the SharePoint list
  • DeliverDatePicker – The second date picker name
Filter Gallery by Calendar date range on Power Apps
Filter Gallery by Calendar date range on Power Apps

Let’s save, publish, and preview the app. Then insert any dates on both the date pickers and we can see the gallery will be filtered as per the date range. Suppose, we have chosen the date from 7/18/2022 to 7/22/2022. The item will appear as below.

Filtering by a Date Range in Power Apps
Filtering by a Date Range in Power Apps

This is how to filter by a date range in the Power Apps gallery.

Read: Power Apps Navigate Function + 16 Examples

Power Apps gallery filter by year

Here we will see how to filter a Power Apps gallery by year. Suppose, we have a SharePoint list named ‘Vendors‘ having a date column like the below:

power apps gallery filter by year
power apps gallery filter by year

Let’s build a Power Apps gallery using the above SharePoint list below:

power apps filter gallery by year
power apps filter gallery by year

To filter the above gallery by year, the following steps are:

  • On the Power Apps, insert a dropdown from the input tab and place it on the screen.
  • Select the dropdown and insert the below code in the Items property. So the years will list in the dropdown control.
Items = [2020,2021,2022,2023]
powerapps filter gallery by years
powerapps filter gallery by years
  • Next, insert the below expression in the gallery’s items property to filter the record as per the selective year.
Items = Filter(vendors, Year(Date) = Dropdown_Year.Selected.Value)

Where,

  • Vendors – The name of the data source
  • Dropdown_Year – The name of the dropdown control
Filter a Power Apps gallery by year
Filter a Power Apps gallery by year

Let’s save, publish and play the app. We can see when we select any year from the dropdown list, the record will be filtered as per the selecting years. Suppose, we have chosen 2021, then the data will come like below:

How to filter a Power Apps gallery by year
How to filter a Power Apps gallery by year

This is how to filter a Power Apps gallery by year.

Read: How to build multilingual apps in PowerApps

Power Apps filter gallery by month or Power Apps filter gallery by radio button

Here, we will see how to filter a gallery by a selective month on Power Apps. Let us take the previous gallery to implement this requirement. As per the requirement, when the user selects any option or month from the radio button, then it will filter the data on the Power Apps gallery and show the filtered data as per the choice.

To do this, the following steps are:

  • On the Power Apps screen, add a radio button and place it beside the gallery.
  • Select the radio button and insert the month names in the ‘Items‘ property like below. So that the month’s name will appear on the radio button.
Items = ["Jun", "Jul", "Aug","Sep"]
power apps gallery filter by month
power apps gallery filter by month
  • Next, select the gallery and insert the below expression in the ‘Items‘ property to filter the date as per the month.
Items = Filter(vendors,Text(Date,"[$-en-US]mmm")=Text(RadioMonth.SelectedText.Value,"[$-en-US]mmm"))

Where,

  • Vendors – The name of the SharePoint data source list
  • Date – The name of the SharePoint date column name
  • RadioMonth – The name of the radio control.

Now, save, publish, and play the app. We can see when we select any month from the radio control it will filter the data in the Power Apps gallery. Suppose, we have chosen the month as ‘Aug‘ then the data will come like below:

powerapps filter gallery by radio button
powerapps filter gallery by radio button

Similarly, if we select ‘Sep‘, it will display a blank gallery because there is no data in the date column for the month of ‘Sep‘.

Power Apps filter gallery by the date picker

In this section, we will see how to filter a Power Apps gallery using a date picker. When, the user, selects any date from the date picker, it will filter the record in the Power Apps gallery and show the filtered data as per the selected date.

We are going to use the previous gallery to implement this need, and the following steps are:

  • On the Power Apps screen, add a date picker and place it near the gallery. We can see, that it will display the current date.
  • Next, select the gallery and insert the below expression in the Items property to filter the data.
Items = Filter(vendors, Date = DatePicker1.SelectedDate)

Now, save, publish, and play the app. Select any date as per your choice from the date picker and click on ok. Suppose we have selected ‘8/1/2022’ and we can see it will show the filtered data in the Power Apps gallery like below:

powerapps gallery filter by date picker
powerapps gallery filter by the date picker

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

Read: PowerApps Chart Control – How to Use

Power Apps filter gallery with multiple dropdowns

Here, we will see how to filter a gallery with multiple dropdowns in Power Apps. Suppose, when the user selects data from the multiple dropdowns, they will be filtered as well as appear in the Power Apps gallery.

Take the previous Power Apps gallery as an example, where we created a Power Apps gallery with the SharePoint ‘Bike Sales’ list as the data source. The steps that follow are:

  • Add 2 dropdowns to the Power Apps screen and place them just above in the Power Apps gallery.
  • From them, select one dropdown and insert the below code to show the bike name within the dropdown list.
Items = ["Thunder360","Harley-Davidson","Enfield 350"]
  • Similarly, select another dropdown and insert the below expression that will allow the user to choose the color of the bike. As it is a SharePoint choice column, so the code will be:
Items = Choices(BikeSales.Color)

Where,

  • BikeSales-The name of the SharePoint list or data source
  • Color: The choice column of the SharePoint list.
Power Apps filter gallery by multiple dropdowns
Power Apps filter gallery by multiple dropdowns
  • Then, select the gallery and insert the below expression in the ‘Items‘ property to filter the Power Apps gallery.
Items = Filter(BikeSales, Title = Dropdown_Title.SelectedText.Value, Color.Value = Dropdown_Color.Selected.Value)

Where,

  • Title– The name of the SharePoint column.
  • Dropdown_Title, Dropdown_Color– The name of the dropdown controls.
  • Color.Value– As the color is a choice column so it is specified as ‘Color.Value‘.
Power Apps gallery filter by multiple dropdowns
Power Apps gallery filtered by multiple dropdowns

Let’s save, publish, and play it in preview mode. We can see that when we select data from both dropdowns, the filtered data will appear in the Power Apps gallery. For example, we have selected the bike name as “Harley-Davidson” and the color as “Black“. Then the data will come in like below:

Power Apps filter gallery with multiple dropdowns
Power Apps filter gallery with multiple dropdowns

This is how to filter a gallery with multiple dropdowns in Power Apps.

Power Apps gallery filter with a button or button OnSelect

Here, we will see how to filter a gallery with a button control on Power Apps. Suppose we have prepared a Power Apps gallery by using the SharePoint data source i.e. Vendors list.

power apps gallery filter with button
power apps gallery filter with a button

Now, with a single button click, we will filter this gallery. Assume the user wants to see only items that have been delivered. To do this, the following steps are:

  • On the Power Apps screen, add a button to the screen and place it near the gallery.
  • Rename the button as’ Delivered‘.
  • Select the button and insert the below expression in the ‘OnSelect‘ property to filter the data with a single tap.
OnSelect = UpdateContext({VarFilter:Filter(vendors,Status.Value = "Delivered")})

Where,

  • VarFilter – The name of the update context variable.
  • Vendors – The name of the SharePoint data source.
  • Status – The name of the SharePoint choice column.
power apps gallery filter with a button
power apps gallery filter with a button
  • Next, select the gallery and insert the variable name in the Items property.
Items = VarFilter

Now, save, publish and play the app in preview mode. We can see when the button is clicked, the data will be filtered and it will show only the items that have been delivered.

power apps filter gallery with a button
power apps filter gallery with a button

This is how to filter a gallery with a button click on Power Apps.

Check: How to create a custom calendar in PowerApps

Power Apps filter gallery with multiple buttons

The above example shows how to filter a gallery with a single button tap. However, this section shows how to filter a Power Apps gallery with multiple buttons. That is when a user clicks a button, the gallery filters and displays the filtered data based on the button clicked.

Let’s take the previous Power App gallery to implement this and the following steps are:

  • On the Power Apps screen, add four button controls and place them beside the gallery.
  • Rename the buttons as per the Sharepoint choice column’s options such as: Delivered, Declined, Will update soon, and All.
powerapps filter gallery with multiple buttons
powerapps filter gallery with multiple buttons
  • Select the ‘Delivered‘ button and insert the below expression into the ‘OnSelect‘ property.
OnSelect = Set(VarStatus, "Delivered")

Where VarStatus is the name of the variable.

  • Similarly, select the ‘Declined‘ button and insert the below expression into the ‘OnSelect‘ property.
OnSelect = Set(VarStatus, "Declined")
  • Again, insert the below expressions in the ‘OnSelect‘ property of the ‘Will update soon‘ and ‘All‘ buttons, respectively.
OnSelect = Set(VarStatus, "Will update soon")
OnSelect = Set(VarStatus, "All")
  • Next, select the gallery and insert the below formula in the Items property to filter the gallery as per the button clicked.
Items = Filter(vendors, If(VarStatus = "All" || IsBlank(VarStatus),true,
VarStatus = "Delivered", Status.Value = "Delivered",VarStatus = "Declined", Status.Value = "Declined",VarStatus = "Will update soon", Status.Value = "Will update soon"))

Where,

  • Vendors-The name of the SharePoint data source.
  • Status.Value-The name of the SharePoint choice column.
powerapps filter gallery by multiple buttons
powerapps filter gallery by multiple buttons

Now, save, publish, and play the app in preview mode. When we click on any button, we can see the data got filtered as per the button clicked.

Suppose, we have clicked the ‘Declined’ button. We can see only those items will come whose status is equal to declined.

Filter Gallery with Buttons using Option Sets on Power Apps
Filter Gallery with Buttons using Option Sets on Power Apps

If we clicked on the ‘All’ button, we can see all the items will be displayed in the Power Apps gallery.

powerapps filter gallery with buttons
powerapps filter gallery with buttons

This is how to filter the gallery with buttons within the powerapps.

Power Apps gallery filter contains()

There are various built-in functions and operators available in the Power Apps canvas gallery. However, developers and consultants with prior programming experience are familiar with some functions that may be missing from Canvas apps. And one such function is contains().

But there are the in and exactin operators that perform the same function as contains(). For example, let’s use these functions to filter only those items containing a specific text.

We are going to use the previous Power Apps gallery that used the SharePoint ‘Project’ list.

power apps gallery filter contains
power apps gallery filter contains

Now, we will filter the above gallery to only show the items that contain ‘Power Apps‘ in their respective ‘Project name’. To do this, the following steps are:

  • Select the gallery.
  • Insert the below expression in the ‘Items’ property.
Items = Filter(Projects, "Power Apps" in Title)

Where,

  • Projects – The name of the SharePoint data source.
  • Power Apps – The specified name to filter
  • in – The name of the operator
  • Title – The name of the SharePoint column.

Once the formula is applied to the Power Apps gallery, we can see it will filter the gallery as per the expression. That means it only shows only those items that contain ‘Power Apps‘ in their Title.

power apps gallery filter contains()
power apps gallery filter contains()

This is how to do power apps gallery filter contains().

Read: Create Login Page in PowerApps using SharePoint List

Power Apps filter gallery startswith

Here we will see how to filter a Power Apps gallery using the startswith(). The StartsWith() function determines whether one text string starts with another.

Let’s take the above gallery by using the startswith(). Assume that when a user enters text into the search bar, the gallery is filtered based on the text if the gallery item begins with the given text. To do this, the following steps are:

  • Insert a text input to the screen and place it just above the gallery. Also, you can add a search icon to the text input.
powerapps filter gallery startswith
powerapps filter gallery startswith
  • Select the gallery and insert the below expression in the Items property.
Items = Filter(Projects,StartsWith(Title, SearchText.Text))

Where,

  • Projects – The name of the SharePoint data source
  • Title – The name of the Sharepoint column
  • SearchText – The name of the Text input.
powerapps gallery filter startswith
powerapps gallery filter startswith

Now save, publish, and play the app. Let’s insert any text into the search box. Suppose we insert a text as ‘Request‘. We can see that it will display a blank gallery as no data starts with Request.

Gallery filter with startswith Power Apps
Gallery filter with startswith Power Apps

Again, if we will insert ‘Power Apps‘ in the search bar, we can see the data will appear which are starts with ‘Power Apps’.

How to filter items using startswith()
How to filter items using startswith() in Power Apps

This is how to filter a PowerApps gallery using Startswith().

Power Apps gallery filters multiple conditions or criteria

This section will look at how to filter a Power Apps gallery based on multiple conditions or criteria. We will also use multiple text inputs to fulfill this requirement.

We will create a gallery using a SharePoint list in accordance with the requirements (ex: product list). We’ll put two text inputs and one drop-down control in that gallery. When a user enters data into those controls, the gallery is filtered based on the information entered.

To do this, the following steps are:

  • We have created a Power Apps gallery on the Power Apps screen using the SharePoint list as a data source.
powerapps gallery filter multiple conditions
powerapps gallery filters multiple conditions.
  • Insert a text input that will be used to filter the products by their name. Then again, insert another text input control that will be used to filter the gallery by their address.
  • Next, insert a drop-down control to select the company name to filter the data.
powerapps filter gallery multiple criteria
powerapps filter gallery multiple criteria
  • To filter the gallery with multiple inputs, insert the below expression in the items property of the gallery.
Items = Filter(Product, Title = TitleTextInput.Text Or ParentCompany.Value = ParentCompanydd.Selected.Value And Address = Address in AddressTextInput.Text)

Where,

  • Product – The name of the SharePoint list
  • Title – The name of the SharePoint column
  • TitleTextInput – The name of the text input to filter the gallery by title
  • Or- Operator
  • ParentCompany- The name of the SharePoint choice column name
  • ParentCompanydd – The name of the dropdown control
  • And- Operator
  • Address- The name of the SharePoint column
  • AddresssTextInput – The name of the text input to filter the gallery by address.
powerapps filter gallery multiple textinputs
powerapps filter gallery multiple text inputs

Let’s save, publish, and play the app in preview mode. Then provide some data on the text inputs and dropdown to check how the multiple filters work in the Power Apps gallery.

Suppose we have inserted the product as ‘Desktop’ or selected the company as ‘Dell‘ and inserted a text for the address. Now, we can see, that the data will be appeared like the below:

powerapps gallery filter multiple criteria
powerapps gallery filters multiple criteria

This is how to filter a PowerApps gallery using multiple criteria.

Read: SharePoint PowerApps Example – Get bank branch details based on State

Power Apps filter gallery descending

Here, we will see how to filter a gallery in descending order within the Power Apps. We are going to use the previous Power Apps gallery that contains the SharePoint ‘BikeSales‘ list.

powerapps filter gallery descending
PowerApps filter gallery descending

In the above gallery, we will filter the order quantity that is more than 20, and also, we will see how to arrange those filtered data in descending order. To do this, the following steps are:

  • On the Power Apps, select the gallery.
  • Insert the below expression in the Items property.
Items = Sort(Filter(BikeSales, Qty > 20),Qty,Descending)

Where,

  • BikeSales – The name of the SharePoint list data source.
  • Qty – The name of the Sharepoint column

Once the expression is applied, we can see the data got filtered as well as sorted in descending order like below:

powerapps gallery filter descending
powerapps gallery filter descending

This is how to filter a Power Apps gallery in descending order.

Power Apps filter gallery Ascending

Similarly, we can filter the Power Apps gallery in ascending order. By this, the filtered items will appear in ascending order.

To work with this, we are going to follow the above example as well as the above steps. Replace the order descending to ascending in the expression.

Items = Sort(Filter(BikeSales, Qty > 20),Qty,Ascending)

Now, we can see the filtered items will appear in ascending order that shown below:

powerapps filter gallery Ascending
powerapps filter gallery Ascending

This is how to filter a gallery in ascending order within Power Apps.

Check: PowerApps tips and tricks

Power Apps filter gallery last 7 days

Now we will look at how to filter a Power Apps gallery to return only data from the last 7 days from the current day.

We are going to use a Power Apps gallery that we have built by using the SharePoint ‘Product‘ list to implement this.

powerapps filter gallery last 7 days
powerapps filter gallery last 7 days

Let us filter the above gallery to return only data whose delivery date comes within the last 7 days of the current day. To fulfill this requirement, the following steps are:

  • Select the gallery.
  • Insert the following formula into the gallery’s ‘Items‘ property to perform the required filtration.
Items = Filter(Product, DeliverDate > DateAdd(Today(),-7,Days))

Where,

  • Product – The name of the SharePoint list.
  • DeliverDate – The name of the SharePoint date column.
  • Today() – It retrieve the current date (i.e. 8/12/2022)

Once the above formula is applied to the PowerApps gallery, we can see it will show only those data whose delivery date becomes under the last 7 days.

powerapps gallery filter last 7 days
powerapps gallery filter last 7 days

This is how to filter a Power Apps gallery to show the items of the last 7 days.

Read: PowerApps form benefits for SharePoint

Power apps filter gallery by lookup or SharePoint lookup field

Here, we will see how to filter a Power Apps gallery based on SharePoint lookup field. Suppose, we have a SharePoint list named ‘Events’ that contains a lookup column i.e. Organizer.

powerapps filter gallery by lookup fields
powerapps filter gallery by lookup fields

Let’s create a gallery using the above SharePoint list and when the user select any organizer from the dropdown the gallery will filter.

To perform this, the following steps are:

  • First, we will build a Power Apps gallery using the above SharePoint list.
powerapps gallery filter by lookup fields
powerapps gallery filter by lookup fields
  • Insert a dropdown control to the Power Apps screen and place it near the gallery.
  • Select the dropdown and insert the below expression in the ‘Items‘ property. As a result, it will display the organizer list within the dropdown.
Items = Choices(Events.Organizer)

Where,

  • Events – The name of the SharePoint data source
  • Organizer – Then name of the SharePoint lookup field
powerapps filter gallery lookup
powerapps filter gallery lookup
  • To filter the gallery by lookup field, insert the below formula in the gallery’s ‘Items‘ property.
Items = Filter(Events, Organizer.Value = 'Organizer Dropdown'.Selected.Value)

Where,

  • Organizer Dropdown – The name of the dropdown control.
powerapps gallery filter lookup
powerapps gallery filter lookup

Let’s save, publish and play the app. We can see, when we select any option from the dropdown it will filter the gallery as per the selective option.

For example, we have choose “Microsoft”, and the data will come like below:

powerapps filter a gallery by lookup field
powerapps filter a gallery by lookup field

This is how to filter a Power Apps gallery by SharePoint lookup field.

Check: Power Apps WeekNum and ISOWeekNum Function with Examples

Power Apps filter gallery multiple combo box

Here, we will see how to filter a Power Apps gallery using multiple combo box. We are going to use the previous Power Apps gallery that contains the SharePoint ‘Bike sales’ list.

powerapps filter gallery multiple combo box
powerapps filter gallery multiple combo box

To filter this above Power Apps gallery by multiple combo box, the following steps are:

  • Add two combox controls to Power Apps. One will be used to select the colour, while the other will be used to select the payment mode.
  • Select first comb box and insert the below expression in the Items property to show all the items of the choice column i.e. Color.
Items = Choices(BikeSales.Color)

Where,

  • BikeSales – The name of the SharePoint list data source
  • Color – The choice column of SharePoint list

Similarly, select the second combo box control and insert the below expression in the Items property to retrieve the items of the ‘Payment mode’ choice column.

Items = Choices(BikeSales.'Payment Mode')

Where,

  • Payment Mode – The name of the choice column of the Sharepoint list
powerapps filter gallery with multiple combo box
powerapps filter gallery with multiple combo box
  • To filter teh gallery as per the multiple selection from the combo boxes, we will insert the below expression in the items property of the Power Apps gallery.
Items = Filter(BikeSales, Color.Value = Color_ComboBox.Selected.Value || 'Payment Mode'.Value = Payment_Mode_ComboBox.Selected.Value)

Where,

  • Color.Value, ‘Payment Mode’.Value – As it is a choice column, so it comes as ‘.Value’
  • Color_ComboBox, Payment_Mode_ComboBox – The name of the combo box control
Filter powerapps gallery using multiple combo box
Filter powerapps gallery using multiple combo box

Now, save, publish and play the app. Let’s select the data in both combo boxes and see the result. For example, we have choose teh color as ‘Red‘ and payment mode as ‘Advance Payment‘.

powerapps filter gallery using multiple combo box
powerapps filter gallery using multiple combo box

This is how to filter a gallery using multiple combo box.

Power Apps filter gallery does not equal

Here we will see how to filter a Power Apps gallery based on what does not equal a specific value. We are going to use a previous Power Apps gallery where we have used the SharePoint ‘Bike Sales‘ list.

powerapps filter gallery not equal
powerapps filter gallery not equal

From the above gallery, now we will filter the items whose payment mode is not equal to “Instant Payment”. Let’s implement this requirement and the following steps are:

  • On the Power Apps screen, select the gallery.
  • Insert the below expression in the ‘Items’ property of the gallery.
Items = Filter(BikeSales, 'Payment Mode'.Value <> "Instant Payment")

Where,

  • BikeSales – The name of the SharePoint data source.
  • Payment Mode.Value – The name of the SharePoint Choice column name.
  • <> – The not equal symbol.

Once the formula is applied to the Power Apps gallery, let’s save, publish, and play the app in preview mode. We can see it will filter the gallery like below:

powerapps gallery filter not equal
powerapps gallery filter not equal

This is how to filter Power Apps gallery items that do not equal a specific item.

Read How to do group by and calculate sum in Power Apps?

Power Apps filter gallery if blank

Here we will see how to filter a gallery that shows all the blank items of the contained data source. For this, we have prepared a SharePoint data source where some fields are blank.

powerapps filter gallery if blank
powerapps filter gallery if blank

Let’s create a PowerApps gallery using the above SharePoint list.

powerapps gallery filter if blank
powerapps gallery filter if blank

To filter the gallery by blank items, insert the below expression in the Items property of the gallery.

Items = Filter(BikeSales,'Payment Mode'.Value = Blank())

Where,

  • BikeSales-The name of the SharePoint list
  • Payment Mode. Value-The choice column of the Sharepoint list

Once the formula is applied to the Power Apps gallery, let’s save, publish, and play the app in Preview mode. We can see it filters the gallery and display only the items that are blank in the data source.

powerapps filter gallery if item blank
powerapps filter gallery if item blank

This is how to filter the blank items in the Power Apps gallery.

Power Apps filter gallery shows all

Here, we will see how to filter a gallery that shows all the items in Power Apps. That means when the user selects the ‘All‘ option from the dropdown list, it will show all the items on the Power Apps gallery; otherwise, it will filter the gallery as per the selecting options from the dropdown.

To do this, the following steps are:

  • On the Power Apps screen, we have created a gallery using a sample SharePoint list like the below:
powerapps filter gallery show all
powerapps filter gallery show all
  • Add a dropdown control to the Power Apps screen and place it near the gallery.
  • Select the dropdown and insert the below expression in the items of the dropdown control, it will show all the choices of the payment mode.
items = Choices(BikeSales.'Payment Mode')

Where Payment Mode is the name of the choice column of the SharePoint list.

powerapps gallery filter show all
powerapps gallery filter shows all
  • Next, set the below expression in the gallery’s items property to filter the gallery as per the dropdown selection.
Items = Filter(BikeSales,'Payment Mode'.Value = Dropdown1.Selected.Value)
powerapps filter gallery show all items
powerapps filter gallery shows all items.
  • Now we want to add the ‘All‘ option in the dropdown. To do this, select the screen where the gallery is placed and then insert the below expression in the OnVisible property of the screen.
OnVisible = ClearCollect(collectPayment,{result:"All"});
            Collect(collectPayment,Distinct(BikeSales,'Payment Mode'.Value));
  • Now, go to the Dropdown’s Items property and update the value to the collection variable as collectPayment.
  • Select the gallery and insert the below expression on the Items property.
Items = If(Dropdown1.Selected.result = "All", BikeSales, Filter(BikeSales,'Payment Mode'.Value = Dropdown1.Selected.Result))

Where Dropdown1 is the name of the dropdown.

Now, save, publish, and play the app in preview mode. When we select the “All option from the dropdown option, it will show all the items below:

How to filter a gallery to show all items
How to filter a gallery to show all items

Similarly, if we select another option, the gallery will display the filtered data based on our selection.

Power Apps filter gallery unique value or distinct filter

Here we will see how to create a distinct filter for a Power Apps gallery. Let us use the previous gallery that contains the SharePoint ‘BikeSales’ list. When the user selects any unique value from the dropdown it will filter the gallery. To do this, the following steps are:

  • On teh Power Apps screen, we have added a dropdown control and placed it just near the gallery.
  • Now, select the Screen and insert the below expression in the OnVisible property of the Screen. That will create a collection on the gallery and hold the distinct or unique values of the title field of the SharePoint list.
OnVisible= ClearCollect(colFilter, Distinct(BikeSales.Title,Title).Result)

Where,

  • ColFilter- The name of the collection
  • BikeSales- The name of the SharePoint data source
  • Title – The name of the SharePoint column name
powerapps filter gallery distinct
powerapps filter gallery distinct
  • Next, insert the variable name in the dropdown’s items property. It will show all the options in the dropdown control.
Items = ColFilter
  • To filter the gallery, select gallery and insert the below expression in the ‘Items’ property.
Items = Filter(BikeSales, Title = TitleDropdown.SelectedText.Value)

where TitleDropdown is the name of the dropdown control.

powerapps gallery filter distinct
powerapps gallery filter distinct

Let’s save, publish, and play the app. We can see this when we select any option from the dropdown, it will filter the gallery as per the selection option.

Create distinct filter on Power Apps gallery
Create a distinct filter on the Power Apps gallery

This is how to create a distinct filter within the Power Apps gallery.

Power Apps filter gallery not empty or hide items

We’ve already seen how to filter a gallery with blank items and how to display items that include blank items. Now we’ll look at how to filter the gallery items that aren’t empty.

Suppose, we have prepared a Power Apps gallery using a SharePoint list that contains some blank values like the below:

powerapps filter gallery not empty
powerapps filter gallery not empty

Let’s filter the above gallery by ‘not empty‘ so that it will show only those items that are not empty as well as hide the empty items too.

To do this, select the gallery and set the below expression in the gallery’s items property.

Items = Filter(BikeSales,Qty <> Blank())

Where Bikesales is the name of the SharePoint list and Qty is the name of the SharePoint column name. Once the formula is applied, save and publish the app. We can see it hides the empty items and only shows the items that are not empty.

powerapps filter gallery hide
powerapps filter gallery hide

This is how to hide the blank items and show the items that are not empty in the PowerApps gallery.

Power Apps filter gallery by another gallery

Here, we will see how to filter a gallery by using another gallery in Power Apps. Suppose, we have 2 SharePoint lists named Vendors and Vendors Code like below:

  • Vendors list
Power Apps filter gallery by another gallery
Power Apps filter gallery by another gallery
  • Vendors code
Power Apps gallery filter by another gallery
Power Apps gallery filter by another gallery

Let’s build Power apps galleries by using the above Sharepoint lists. When the user selects any items from the ‘Vendors code‘, it will filter the items in the ‘vendors’ gallery and display the filtered items as per the selecting option within the gallery. To implement this, the following steps are:

  • First, we need to build 2 galleries on the Power Apps using the above SharePoint lists respectively.
Filter Gallery based on another Gallery
Filter Gallery based on another Gallery
  • Select the second gallery where the vendors’ data source is placed and set the below expression in the items property.
Items = Filter(vendors,VCode.Value=VendorCodesGallery.Selected.VendorCode)

Where,

  • Vendors: The name of the SharePoint data source
  • VCode.Value:The name of the SharePoint choice column
  • VendorCodesGallery: The name of the second gallery where only vendor codes are placed.
  • VendorCode: The name of the SharePoint column.
Filtering a gallery based on another gallery Power Apps
Filtering a gallery based on another gallery Power Apps
  • To identify the selected item on the first gallery (where only codes are placed), select the gallery and insert the below formula in the Template fill property.
TemplateFill = If(ThisItem.IsSelected,LightCyan,AntiqueWhite)
Filter Gallery based on another Gallery Power Apps
Filter Gallery based on another Gallery Power Apps

Now, save, publish, and preview the app. Suppose, we have selected ‘DF147‘ on the first gallery and we can see the filtered items will appear as below:

Power Apps Filter Gallery based on another Gallery
Power Apps Filter Gallery based on another Gallery

This is how to filter a gallery based on another gallery within Power Apps.

Power Apps filter gallery with search

Here, we will see how to use a filter function with a search function. That means we want to put both filters() and search() together.

Suppose, we have prepared a gallery using the SharePoint list where we have inserted the below function in the Items property of the gallery to filter teh gallery by a specific ID.

Items = Filter(BikeSales, BikeID = 360)

Where,

  • BikeSales: The name of the SharePoint data source
  • BikeID: The name of the number column of the SharePoint list
powerapps filter gallery with search
powerapps filter gallery with search

But we also need to include a search function so that users can find specific numbers while the app is retrieving data from a data source.

To meet this requirement, we must provide a text column rather than a number column because the search() function expects a text type value. We will use AddColumn() to provide a text column to meet this requirement.

  • Let’s insert a text input to the Power Apps screen and place it just above the gallery.
  • Set the visible property of the text input as false or set the toggle off in the visible property.
  • Select the gallery and insert the below expression in the Items property.
Items = Search(AddColumns(Filter(BikeSales, BikeID = 360), "TextBikeID",Text(BikeID)), TextInput1.Text, "TextBikeID")

Where,

  • TextBikeID – The name of the new column
  • Text(BikeID) – To convert the number into text
  • TextInput1 – The name of the text input.

Once the formula is applied we can see the filtered data will appear within the gallery like below:

powerapps gallery filter with search
powerapps gallery filter with search

This is how to filter a Power Apps gallery with search().

Power Apps filter gallery multiple check box

Here, we will see how to filter a gallery using multiple checkboxes. That means when the user selects multiple choices via check boxes, the gallery will be filtered as per the choices.

We are going to use the previous Power Apps gallery to implement this. The following steps are:

  • On the Power Apps screen, we have prepared a Power Apps gallery using the SharePoint list (ex-Bike sales).
  • As we want to filter the gallery as per the payment mode, we will add 3 check box controls to the screen and place them near the gallery.
  • Select each check box and enter the text ‘Instant Payment, Advance Payment, or Installment Payment‘ in the text property respectively.
powerapps filter gallery multiple check box
powerapps filter gallery multiple check box
  • To filter the gallery as per the check box selection, insert the below formula in the items property of the gallery.
Items = Filter(BikeSales,If(InstantCheckbox.Value,'Payment Mode'.Value = "Instant Payment") || If(AdvanceCheckbox.Value,'Payment Mode'.Value = "Advance Payment") || If(InstallmentCheckbox.Value,'Payment Mode'.Value = "Installment Payment"))

Where,

  • BikeSales-The name of the data source
  • InstantCheckbox, AdvanceCheckbox, InstallmentCheckbox-The name of the check box controls
  • Payment Mode.Value: The choice column of the SharePoint list.
powerapps filter gallery with if
powerapps filter gallery with if

Let’s save, publish, and play the app. Suppose we have checked the first check box, i.e., Instant Payment, and the gallery will appear like below:

powerapps filter gallery if statement
powerapps filter gallery if statement

Similarly, if we select both Instant Payment and Advance Payment, then the gallery will be like the below:

powerapps gallery filter if statement
powerapps gallery filter if statement

This is how to filter a gallery with an if statement or use multiple checkboxes.

Power Apps filter gallery by field value

Here, we will see how to filter a gallery by field value. We are going to use the previous Power Apps gallery that contains a SharePoint list.

powerapps filter gallery by column
powerapps filter gallery by column

Now, we will filter the above whose VCode field value is equal to DF147 or AC123. To do this, select the gallery and insert the below expression in the Items property.

Items = Filter(vendors, VCode.Value = "AC123" Or VCode.Value = "DF147")

Where VCode.Value is the name of teh choice column of the SharePoint list. Once the formula is applied to the Power Apps gallery, we can see it will appear only the filtered items as per the field value.

powerapps filter gallery by column value
powerapps filter gallery by column value

This is how to filter a Power Apps gallery by field value or column.

Power Apps filter gallery by People Picker

Here, we will see how to filter a Power Apps gallery by the People picker column. Suppose, we have prepared a Power Apps gallery using a SharePoint list that contains a people picker column i.e., ProjectHandler.

powerapps filter gallery by People Picker
Power Apps filter gallery by People Picker

Let’s filter the above gallery by People Picker which means we want to show only those data where the project handler is “Sonam Subhadarsini“.

To do this, insert the below formula in the items property of the gallery.

Items = Filter(Projects, ProjectHandler.DisplayName = "Sonam Subhadarsini")

Where,

  • Projects – The name of teh data source
  • ProjectHandler.DisplayName – It retrieves the display name of the people picker column (i.e., ProjectHandler)

Once the formula is applied, we can see it will filter the data like the below:

powerapps gallery filter by People Picker
Power Apps gallery filter by People Picker

This is how to filter a Power Apps gallery by people picker.

Power Apps filter gallery by id

Here, we will see how to filter a Power Apps gallery by using an ID. We are going to use the previous Power Apps gallery that contains the SharePoint list i.e., Bike Sales.

powerapps filter gallery by id
powerapps filter gallery by id

Let’s filter this above gallery by id i.e., Bike ID. To do this, the following steps are:

  • On the Power Apps screen, add a dropdown control and place it near the gallery.
  • Select the dropdown control and insert the below expression. As a result, the dropdown will hold the bike id, as well as the user, can select the id from that dropdown control.
Items = Distinct(BikeSales,BikeID)
powerapps gallery filter by id
powerapps gallery filter by id
  • To filter the gallery by ID, insert the below expression in the items property of the gallery.
Items = Filter(BikeSales, BikeID = BikeIDDropdown.Selected.Result)

Where BikeIDDropdown is the name of the dropdown control.

Filter gallery by id on powerapps
Filter gallery by id on powerapps
  • Let’s save, publish, and play the app. We can see when we select any option from the dropdown it will reflect on the gallery. Suppose, we have selected the ID as 470, then the gallery will appear like below:
powerapps filter a gallery by id
Power Apps filter a gallery by id

This is how to filter a Power Apps gallery by ID.

Also, you may like some more Power Apps Tutorials:

Conclusion

  1. What is the Power Apps gallery filter?
  2. How to filter the Yes/No column in the Power Apps gallery?
  3. How to filter the Power Apps gallery by current user?
  4. How to filter a gallery based on the dropdown selection in Power Apps?
  5. How to filter a powerapps gallery by text input?
  6. How to filter a gallery using a combo box?
  7. How to filter a gallery by date in Power Apps?
  8. How to filter a gallery by a date range in Power Apps?
  9. How to filter a gallery by year in Power Apps?
  10. How to filter a gallery by radio control or by month in Power Apps?
  11. How to filter a gallery by a date picker?
  12. How to filter a gallery using multiple dropdowns in Power Apps?
  13. How to filter a gallery with a single button click in Power Apps?
  14. How to filter a Power Apps gallery using multiple buttons?
  15. How to filter a Power Apps gallery if the item contains a specific text?
  16. How to filter a Power Apps gallery using the startswith() function?
  17. How to filter a Power Apps gallery using multiple criteria?
  18. How to filter a Power Apps gallery by ascending order?
  19. How to filter a gallery by descending order in Power Apps?
  20. How to filter the Power Apps gallery by the last 7 days?
  21. How to filter the Power Apps gallery by SharePoint lookup field?
  22. How to filter the Power App gallery by using multiple combo boxes?
  23. How to filter a gallery by not equals in Power Apps?
  24. How to filter a gallery by blank items in the Power Apps gallery?
  25. How to filter a gallery that shows all the items?
  26. How to create a distinct gallery on Power Apps?
  27. How to filter a gallery that does not empty or hide the empty items?
  28. How to filter a gallery by another gallery on Power Apps?
  29. How to filter a gallery with a search function on Power Apps?
  30. How to filter a gallery with multiple checkbox selections on Power Apps?
  31. How to filter a Power Apps gallery by field value?
  32. How to filter a gallery by a people picker column on Power Apps?
  33. How to filter a gallery by ID on Power Apps?
>