In this Microsoft Power Apps tutorial, we will learn how to remove duplicate rows in Power Apps Collection.
Additionally, we will discuss the “ThisRecord” property to remove duplicate rows from the Power Apps collection using a single line of code. And also how to use the Distinct () function to remove duplicate values in a Power Apps collection.
Remove Duplicate Rows in Power Apps Collection
- Creating a Power Apps collection makes adding a group of similar items to a table easier. Also, you can easily remove unwanted data, like duplicate columns or rows.
- The screenshot below shows 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.
- We can use the Distinct () function in the code below to remove all the duplicate rows from the Power Apps Collection.
- The image below shows two duplicate records [Grocery, Cab ride]. When a user clicks on the Remove rows button, these two duplicates will be removed from the collection, and the result will be displayed in the Power Apps Data table [2nd below image].

To achieve it, follow the below steps. Such as:
- Open Power Apps with your valid Microsoft 365 credentials -> Select the app where you want to add a Power Apps collection -> Select a screen and rename it to CollectionScreen.
- Insert a Power Apps Button control (Expenses collection) -> Set its OnSelect property code like below.
OnSelect = ClearCollect(colExpenses,
{Item: "Grocery", Category: "Food", PurchasDate: "8/30/2023", Amount: 1000},
{Item: "Wallpapers", Category: "Household", PurchasDate: "8/31/2023", Amount: 1500},
{Item: "Cab ride", Category: "Car/Trasport", PurchasDate: "9/1/2023", Amount: 900},
{Item: "Health checkup", Category: "Ford", PurchasDate: "9/2/2023", Amount: 2200},
{Item: "Grocery", Category: "Food", PurchasDate: "8/30/2023", Amount:1000},
{Item: "Cab ride", Category: "Car/Trasport", PurchasDate: "9/1/2023", Amount:900},
{Item: "Loan payments", Category: "Personal", PurchasDate: "9/3/2023", Amount: 2000})
Where,
- colExpenses = Collection Name
- Item, Category, PurchasDate, Amount = Collection Headers
- “Grocery“, “Food“, “8/30/2023“, 1000 = Collection Values/Records

- Then, insert a Data table and set its Items property as:
Items = colExpenses
- To display the collection fields in the data table control, click on the Edit fields option and add fields as per your need.

- Now, click the button control [Expenses collection] to display the Power Apps collection like below.

- Here, you can see that, in the Power Apps collection, you can find duplicate rows shown below.

- To remove these duplicate rows from the Power Apps collection, insert another Power Apps Button control (Remove rows) and set its OnSelect property code like below.
OnSelect = ClearCollect(colRemoveRows,ForAll(Distinct(colExpenses,ThisRecord),Value))
Where,
- ClearCollect = We can use this function to delete all the records from a collection then add a different set of records to the same collection.
- colRemoveRows = You can set a collection to remove duplicate rows.
- ForAll = We can use this function to evaluate the formula for a single record.
- Distinct = You can use this function to remove duplicate values from a Power Apps collection.
- colExpenses = It is our Power Apps collection name.
- ThisRecord = We can use this function to remove all duplicate rows from a collection.

- Then, insert another Data table and set its Items property as:
Items = colRemoveRows
To display the collection fields in the data table control, click on the Edit fields option and add fields as per your need.

- Now, click on the button control [Remove rows] to display the Power Apps collection without any duplicate rows, as shown below.

This is all about how we can remove duplicate rows from a Power Apps collection.
Also, you may like some more Power Apps tutrorials:
- How to Share Power Apps With External Users?
- Share a Power Apps App Within an Organization
- Power Apps Modern Date Picker Control
- How to Create a Canvas App in Power Apps
- Add a Lookup Column to Power Apps Collection
Conclusion
Whenever you want to remove duplicate rows from a Power Apps collection, you can use a distinct function to delete all duplicate rows.
Here, from this Microsoft Power Apps tutorial, we learned all about the Power Apps collection and removing duplicate rows. Then, we discussed how to remove duplicate rows from a Power Apps collection. Also, we covered how to use the “Distinct Function” and “ThisRecord Property” to remove all duplicate rows in a Power Apps collection.

Preeti Sahu is an expert in Power Apps and has more than 6 years of experience working with SharePoint and the Power Platform. As a Power Platform expert for Power BI, Power Apps, Power Automate, Power Virtual Agents, and Power Pages, she is currently employed with TSinfo Technologies. She is the author of the book Microsoft Power Platform A Deep Dive. She also made a big technical contribution to SharePointDotNet.com in the form of articles on the Power Platform. She enjoys traveling and spending time with her family in her spare time.