web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : TTA8SdTUx6QPE0bKbu9ppm
Power Apps - Building Power Apps
Unanswered

How do I remove duplicate rows with 2 columns in a collection

Like (0) ShareShare
ReportReport
Posted on 17 Jan 2024 07:34:30 by 13

In my Gallery, I only shows Title of books, but in the backend information, it has several variables like BookID, Publisher, BookTitle and etc... All the variables are in a collection called colDistinct.

The question is how can I show Title of books with no duplicate value (distinct BookID and BookTitle)?
I want to remove duplicates BookID and BookTitle and display the final result in the Gallery.

I have the same question (0)
  • WarrenBelz Profile Picture
    150,917 Most Valuable Professional on 18 Jan 2024 at 21:15:58
    Re: How do I remove duplicate rows with 2 columns in a collection

    @Anonmyous123 ,

    GroupBy() eliminates duplicates, but only returns the grouped column/s and a Table containing the rest of the grouped records. The code I supplied then shows how to re-include these. Please have an attempt at it and I am happy to correct if required.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Anonmyous123 Profile Picture
    13 on 18 Jan 2024 at 15:19:53
    Re: How do I remove duplicate rows with 2 columns in a collection

    I've tried this formula but it is not work.

  • Anonmyous123 Profile Picture
    13 on 18 Jan 2024 at 15:18:14
    Re: How do I remove duplicate rows with 2 columns in a collection

    I am not sure how applies in this case. Would you mind simplifying this explanation for me? I'm still new to Power Apps and want to make sure I fully understand. Thank you in advance.

     

  • Jonathan Manrique Profile Picture
    2,687 on 17 Jan 2024 at 08:13:32
    Re: How do I remove duplicate rows with 2 columns in a collection

    Hi @Anonmyous123 

     

    Hello, can you try this formula?

     

    ClearCollect(
     UniqueCollection,
     RemoveIf(
     DuplicatesCollection,
     CountRows(
     Filter(
     DuplicatesCollection,
     Column1 = ThisRecord.Column1 && Column2 = ThisRecord.Column2
     )
     ) > 1
     )
    )

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    You can accept more than one post as a solution

  • WarrenBelz Profile Picture
    150,917 Most Valuable Professional on 17 Jan 2024 at 07:46:17
    Re: How do I remove duplicate rows with 2 columns in a collection

    Hi @Anonmyous123 ,

    You could use GroupBy, but you will need to "add back" any columns not in BookID or BookTitle

    AddColumns(
     GroupBy(
     DataSource,
     "BookID",
     "BookTitle",
     "Data"
     ),
     "Column1Name",
     First(Data).Column1Name,
     "Column2Name",
     First(Data).Column2Name
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 885 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 571

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 352 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete