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 / How to rank summed gal...
Power Apps
Answered

How to rank summed gallery items, help appreciated

(0) ShareShare
ReportReport
Posted on by 35

Hello, I'm trying to create a leaderboard whereby the scores are grouped by team name (TeamAliasText) and summed by points. I am able to get the gallery to group and sum. But I cannot get the ranking to work 😞

 

This is what I have under items for the gallery, 

 

SortByColumns(
 AddColumns(
  GroupBy('Game Scores',"TeamAliasText","GroupedItems"),
"Sum of Value",Sum(GroupedItems,Points)

),
"Sum of Value",
SortOrder.Descending
)

 

Current result:

Jake_Daniels_9_0-1701706754375.png

Hoping to have, ranking on the left

Jake_Daniels_9_1-1701706890208.png

Ungroup(
  ForAll(
   Sequence(CountRows('Game Scores')),
 {
myRecord: Table(
 Last(
     FirstN( Sort('Game Scores', Points, SortOrder.Descending),
  Value
)
  )
    ),
RowNumber: Value
}
 ),
"myRecord"
 )

 

I can't seem to get both of these working together.

Categories:
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    You can use something like the expression below. If you "save" the sorted expression that you have, you can use a ForAll with the sequence of indices, and use the Patch function to merge the RowNumber record with the record from the sorted list.

    With(
     {
     sorted: SortByColumns(
     AddColumns(
     GroupBy( 'Game Scores', "TeamAliasText", "GroupedItems"),
     "Sum of Value",
     Sum(GroupedItems,Points)
     ),
     "Sum of Value",
     SortOrder.Descending
     )
     },
     ForAll(
     Sequence(CountRows(sorted)),
     Patch(
     { RowNumber: Value },
     Index(sorted, Value)
     )
     )
    )
    

    Hope this helps!

  • Jake_Daniels_9 Profile Picture
    35 on at

    I get you now thank you so much! It works and that makes sense. Appreciate your solution.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard