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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I remove duplic...
Power Apps
Unanswered

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

(0) ShareShare
ReportReport
Posted on 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.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,075 Most Valuable Professional on at

    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

  • Jonathan Manrique Profile Picture
    2,687 on at

    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

  • Anonmyous123 Profile Picture
    13 on at

    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.

     

  • Anonmyous123 Profile Picture
    13 on at

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

  • WarrenBelz Profile Picture
    153,075 Most Valuable Professional on at

    @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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard