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 / Creating a gallery tha...
Power Apps
Answered

Creating a gallery that shows sum of points per participant

(1) ShareShare
ReportReport
Posted on by 178

Good day

 

I have an app that allows users to register achievements, and earn points.

the current system looks a bit like this

 

UserAchievementPoints
JohnA5
MaryA5
PeterB2
JohnB2
MaryC6

 

I want to create a leader board that shows, from most to least each user and the total number points accumulated, like this

Mary 11 Points

John 7 Points

Peter 2

I think a gallery sorted by total points would be good.

I am stuck with how to specify the Items in the gallery and the controls in the template

 

Many Thanks

Categories:
  • TxTechnician Profile Picture
    98 on at

    The data source is an excel table called "Table1" in this example:

    TxTechnician_0-1666044664795.png

     

    TxTechnician_1-1666044726335.png

     

    You select gallery items by specifying their datasource title.  So in this case it was

    Sum(Gallery2.AllItems, Points)
  • GreenJaguar Profile Picture
    178 on at

    Thanks @TxTechnician 

    This is not quite the scenario I have in mind.  The table indeed is as you describe, the desired output is more like this

    null.png

  • Verified answer
    cmyoung07 Profile Picture
    125 on at

    You will want to use the group by function. Here is a good article with an example on using it: Group BY - MatthewDevaney 

     

    I threw this code on a button to load it and apply it to his logic: 

    ClearCollect(myData,
    {User: "John", Achievement: "A", Points: 5},
    {User: "Mary", Achievement: "A", Points: 5},
    {User: "Peter", Achievement: "B", Points: 2},
    {User: "John", Achievement: "B", Points: 2},
    {User: "Mary", Achievement: "C", Points: 6}
    );
    
    //Group by and sum 
    ClearCollect(
     mySummedData,
     DropColumns(
     AddColumns(
     GroupBy(myData,"User","GroupedItems"),
     "Sum of Value",Sum(GroupedItems,Points)
     ),
     "GroupedItems"
     )
    );

     

    I then created 2  galleries, 1 to show the data and 1 to show the grouped/Summed data. The items for the first gallery is just the 'myData' collection from above. The grouped gallery is using:

    SortByColumns(mySummedData,"Sum of Value",Descending)

     

    This the result I get: 

    GroupBy.png

  • GreenJaguar Profile Picture
    178 on at

    @cmyoung07 Thanks.  This is great.  Much appreciated

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
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard