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 / Distinct and sum 2 col...
Power Apps
Answered

Distinct and sum 2 columns

(0) ShareShare
ReportReport
Posted on by 339

Hello, 

 

In my sharepoint list i have the following items:

 

Title - Number

 

Test A - 4

Test A - 2

Test A - 2

Test B - 3

Test C - 2

Test B - 3

 

I want to put that information in a gallery but remove duplicates and add them together, so in reality, the gallery on PowerApps should be showing this:

 

Test A - 8

Test B - 6

Test C - 2

 

I can remove duplicates, but not sum.

Using sum will give a random number that i do not want

 

Can somebody help?

 

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @Field 

    This is a classic Collections problem called "How can I GROUPBY a column and SUM the values".  Here's the solution

     

    ClearCollect(
     myGroupedCollection,
     GroupBy(your_datasource_name,"Title","GroupedItems")
    );
    
    ClearCollect(
     mySolution,
     DropColumns(
     AddColumns(myGroupedExpenses,"Sum of Value",Sum(GroupedItems,Value)),
     "GroupedItems"
     )
    );
    

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Mana Profile Picture
    171 on at

    Hello @Field  @mdevaney ,

    Thanks for sharing. I am dealing with the same problem. having:

    ProductName      ProductAmount

    A                                6

    B                                2

    C                                3

    A                                2

    A                                5

     

    But I want to have:

    ProductName      ProductAmount

    A                                13

    B                                2

    C                                3

     

    I can't see how to use your solution regarding my fields. would you please help me

     

     

     

  • Mana Profile Picture
    171 on at

    By the way the name of my first collection is colProduct wich has duplicates

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard