Skip to main content

Notifications

Community site session details

Community site session details

Session Id : EDuOMhIWiaSsfZu6MrULri
Power Apps - Building Power Apps
Answered

Check for Duplicates in a single column collection

Like (0) ShareShare
ReportReport
Posted on 4 Aug 2022 03:59:41 by 6

Hi I need help to check if a collection contains duplicates of each other.

I have 1 collection "Materials"

-Wood

-Iron

-Wood

-Plastic

 

From a click of a button: I would like to detect that there are duplicates within the collection, in the example above it will see that wood is listed twice and is considered duplicate. 

Any help is appreciated. Thank you!

Categories:
  • Verified answer
    rb Profile Picture
    833 Super User 2024 Season 1 on 04 Aug 2022 at 04:37:32
    Re: Check for Duplicates in a single column collection

    I don't know what you want to do with the information, but I will show you how I would check. Group by the column(s) you are checking for duplicates of, then any group with more than one record will indicate a duplicate:

     

    Button:

    ClearCollect(
     colMaterials,
     ["Wood","Iron","Wood","Plastic"]
    );
    
    ClearCollect(
     colMaterialOccurences,
     AddColumns(
     GroupBy(
     colMaterials,
     "Value",
     "ValueGroup"
     ),
     "OccurenceCount",
     CountRows(ThisRecord.ValueGroup)
     )
    );
    

    Label:

    "Duplicates Exist: " & !IsEmpty(Filter(colMaterialOccurences, OccurenceCount > 1))

    metsshan_0-1659587781736.png

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 134

#3
stampcoin Profile Picture

stampcoin 117

Overall leaderboard
Loading started