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 :
Power Apps - Building Power Apps
Answered

How to remove duplicates from a datatable display

(0) ShareShare
ReportReport
Posted on by 35

Hello,

 

In the Datatable below, I am using a collection to populate certain values for a user to view/screenshot an estimate for review.

 

My collection adds a record for each item selected in a Gallery on a prior screen. What I would like to be able to do in the Datatable below is display only the row with the highest quantity Products.

 

For example, Product 1 should have only one row with quantity 2, Product 2 should have only one row with quantity 2, Product 3 should have only one row with quantity 2, and Product 4 should have only one row with quantity 4.

 

I have tried utilizing distinct for this, but as that only returns a one column result, it does not seem to be a strong solution

 

 

 

I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    151,759 Most Valuable Professional on at
    Re: How to remove duplicates from a datatable display

    Hi @TitanicTips23 ,

    Assuming Product, Value and Price are the same on duplicated items and you want the record with the highest Quantity

    AddColumns(
     GroupBy
     Sort(
     SPListName,
     Quantity,
     SortOrder.Descending
     ),
     "Product",
     "Value",
     "Price",
     "Grouped"
     ),
     "Quantity",
     First(Grouped).Quantity,
     "Total",
     First(Grouped).Total
    )

     

    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

  • TitanicTips23 Profile Picture
    35 on at
    Re: How to remove duplicates from a datatable display

    Thanks @WarrenBelz ! This worked like a charm!

     

    I am still fairly new to PowerApps, and although I've been working with Dax (be it fairly lightly) for awhile, I still have trouble understanding how to format my code like you did here. Do you have any suggestions for resources to get a good framework of code formatting?

  • WarrenBelz Profile Picture
    151,759 Most Valuable Professional on at
    Re: How to remove duplicates from a datatable display

    Hi @TitanicTips23 ,

    I have a site with quite a bit of basic matters and the Microsoft documentation itself is a very useful resource.

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…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 671 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 424 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 243

Last 30 days Overall leaderboard