Skip to main content

Notifications

Community site session details

Community site session details

Session Id : SvsjPhPIEcpacW5L4nPZ+l
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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

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

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started
Loading complete