cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AmitLoh-Powerap
Kudo Kingpin
Kudo Kingpin

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?

1 ACCEPTED SOLUTION

Accepted Solutions
rnavarro
Regular Visitor

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.

View solution in original post

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

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
Regular Visitor

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.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (29,370)