cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

how to remove duplicates from collection

I have a collection created with duplicate records. Distinct give me single column record which I do not want.

I just want to remove duplicate rows from collection based on one column but it should return collection again(not one column)

how to remove duplicates from collection?

2 REPLIES 2
Community Support Team
Community Support Team

Re: how to remove duplicates from collection

Hi @AmitLoh-Powerap,

 

Thanks for the question.

Currently I can't find a way available to remove duplicate records from collection in PowerApps.

The only function that would work with the Duplicate records is Distinct function, and it will only return single columns.

We could archive the duplicate records by using GrouPBy function:

GroupBy and Ungroup functions in PowerApps

Please check to see if the groupby function could be a workaround.

In addition, please also submit an idea regarding delete the duplicate records.

Regards

 

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rnavarro
Level: Powered On

Re: how to remove duplicates from collection

I found a way to remove duplicates. It is not efficient, but it works!

 

1- create a column in the collection that concatenates all values that can define the tuple as unique.

2 - create a "temporary" collection with the distinct values from this new column. 

 

ClearCollect(tempCol,Distinct(originalCollection, NEWCOLUMN));

 

3- execute a loop in this tempCol and filtering and getting the first values from the originalCollection, and storing them in a second "temporary" collection.

 

ForAll(tempCol,Collect(tempCol2,First(Filter(originalCollection , NEWCOLUMN=Result))));

 

4- Replace the originalCollection by the second "temporary" collection.

 

ClearCollect(projectLocation,tempCol2)

 

5- its done! you have a new collection with all duplicated values removed. 

 

OBS: Make sure you concatenated the correct columns in order to make the tuple unique.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,636)