In this Microsoft Power Apps tutorial, we will learn how to display distinct values in Power Apps gallery.
Additionally, we will discuss the Distinct() function to remove duplicate collection records in a Power Apps gallery using a single line of code.
Display Power Apps Gallery Distinct Values
- The Power Apps Gallery control can display multiple records from a data source, and each record can contain multiple types of data.
- In Power Apps, I have a Gallery control named [gal_Diseases], and this gallery contains SharePoint list records, including the duplicate records that I don’t want to display on the gallery control.
Refer to the below screenshot:

- We can use the Distinct() function to remove duplicate rows or records in the Power Apps gallery control not in the SharePoint list.
- The image below shows two duplicate records [Malaria, Lyme disease]. When a user uses the distinct function in the gallery items property, these two duplicates will be removed from the gallery control, and it will display only the unique values.

To work around this example, follow the below steps. Such as:
1. Create a Blank canvas app and connect it to the respective SharePoint list [Diseases List] like below.

2. On the Power Apps Screen -> Insert a Gallery control [gal_Diseases] and set its Items property as:
Items = 'Diseases List'
3. To display the Disease field records, change the gallery layout to “Title” as shown below.

4. Now, I want to remove these two duplicate records from the gallery. For that, select a gallery control and set its Items property to the code below.
Items = Distinct(
'Diseases List',
Disease
)
Where,
- Distinct() = This Distinct function assesses a formula for every record in a table and returns a single-column table of outcomes, eliminating any duplicates
- ‘Diseases List’ = SharePoint Online list
- Disease = SharePoint list title field
5. Also, you should change the title field value from “ThisItem.Disease to “Value” to display the distinct values as shown below.

6. Once the app is ready, Save, Publish, and Preview the app. When a user opens the gallery control, it will display distinct unique records as in the screenshot below.

Display Power Apps Gallery Distinct Values from Collection
Next, we will see how to display Power Apps gallery distinct values from a collection with a simple scenario.
Scenario:
I have a Power Apps Collection named “Expenses Collection.” In this collection, I have added data with different columns and rows. Also, this collection has some duplicate rows that I don’t want.
The image below shows two duplicate records [Grocery, Cab ride]. When a user clicks on the Remove rows butt