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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove duplicate row f...
Power Apps
Answered

Remove duplicate row form collection

(0) ShareShare
ReportReport
Posted on by 457

Hi,

My collection has five column. I want to check four column value same or not. If it is same I consider it is duplicate. So I want to remove.

 

Ex;

country Did dname Bname amt

India 1 Admin Sales 100

India 1 Admin Sales 200

 

Now I want to check collection row without amt column if it is same I want to remove any one of the row.

@Mike8 

@WarrenBelz 

@RandyHayes 

@Pstork1 

@v-xiaochen-msft 

@timl 

@BCLS776 

@Nogueira1306 

@v-bofeng-msft 

@gabibalaban 

@TheRobRush 

 

Categories:
I have the same question (0)
  • MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hi @Gelos 

     

    I tried to reproduce your request with a table in Power Apps:

    ClearCollect(
     colDuplicates,
     Table(
     {country:"India",Did:1,dname:"Admin",Bname:"Sales",amt:100},
     {country:"India",Did:1,dname:"Admin",Bname:"Sales",amt:200},
     {country:"US",Did:2,dname:"Admin",Bname:"IT",amt:100},
     {country:"Germany",Did:2,dname:"Admin",Bname:"IT",amt:200},
     {country:"Germany",Did:2,dname:"Admin",Bname:"IT",amt:100}
     )
    )

     

    In this table are some duplicates and some single items but with similar values. I used a Temp Table to drop the "amt" column and only get the distinct values, afterwards I create my result table using an "addcolumns" and lookup to get the information from the source:

    ClearCollect(
     colTemp,
     ForAll(
     Distinct(
     DropColumns(
     colDuplicates,
     "amt"
     ),
     ThisRecord
     ),
     ThisRecord.Result
     )
    );
    
    ClearCollect(
     colUnique,
     AddColumns(
     colTemp,
     "amt",
     LookUp(
     colDuplicates,
     Bname = colTemp[@Bname] &&
     Did = colTemp[@Did] &&
     country = colTemp[@country] &&
     dname = colTemp[@dname],
     amt
     )
     )
    )

     

    Maybe you could also combine this into one formula without a temp table, but this is easier to understand. My result looks like this: 

    Image 637.png

     

    Hope this helps you!

     

    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

  • Gelos Profile Picture
    457 on at

    Ok I will try this. Thanks for replay but I have another question. Please help me

    I want to show this collection in Rich text box how can I do that

    @MarvinBangert 

  • MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    You can combine the values from a table using "Concat()" and using an html "<br>" to break after each line:

     

     

    Concat(
     colUnique,
     "Bname: " & Bname 
     & ", dname: " & dname 
     & ", did: " & Did 
     & ", country: " & country 
     & ", amt: " & amt,
     "<br>"
    )

     

     

    Just add this to a Rich Text Editor - Default:

    Image 638.png

     

    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

  • Gelos Profile Picture
    457 on at

    Ok I will try Can I show that in rich text editor.

    @MarvinBangert 

  • Gelos Profile Picture
    457 on at

    I want looks like that, But border is not important. I want this format.

    CountryProject IdDept. Id Dept. NameBudget IdBudget HeadOriginal Amount
    India11AdminINADMIN003Sales100
    UnitedSatateAmerica11AdminINADMIN003Sales100
  • Verified answer
    MarvinBangert Profile Picture
    1,924 Most Valuable Professional on at

    Hi @Gelos 

    within your "Rich Text - Default" property you use HTML to show your code as you want:

    "<table>
     <tr>
     <th> Bname </th>
     <th> dname </th>
     <th> Did </th>
     <th> country </th>
     <th> amt </th>
     </tr>" &
     Concat(
     colUnique,
     Concatenate(
     "<tr>
     <td>",ThisRecord.Bname,"</td>
     <td>",ThisRecord.dname,"</td>
     <td>",Text(ThisRecord.Did),"</td>
     <td>",ThisRecord.country,"</td>
     <td>",Text(ThisRecord.amt),"</td>
     </tr>"
     )
     )
     &
    "</table>"

     

    The table stucture comes from the "<table><tr><td/th>" using HTML, the concat function brings the whole table into one string and the Concatenate() function combines multiple text-fields. Some values like "Did" and "amt" needed to be transform into a text value using text(). With this structure you build your table for each item within your collection.

     

    Some information about HTML you will find here: HTML Tutorial (w3schools.com)

    You can also add some CSS within your HTML (inline, using CSS from header is not supported as I know: Solved: It is possible to declare css in powerapps? - Power Platform Community (microsoft.com) ) to add borders, colors etc. here is an example: Solved: HTMLText with CSS - Power Platform Community (microsoft.com)

     

    My result with the example code above looks like this:

    Image 640.png

     

    Hope this helps you!

     

    Best regards
    Marvin

    If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

  • Gelos Profile Picture
    457 on at

    Thank You.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 638

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard