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 make a ranked l...
Power Apps
Answered

How to make a ranked leaderboard?

(0) ShareShare
ReportReport
Posted on by 24

I've got a Sharepoint list whose columns are Email, Display Name, and Points for each daily quiz people take. I'm trying to create a ranked leaderboard in a Gallery that shows a Ranking (1, 2, 3...), the display name, and total points. 

 

So far, I can use the below code to add up each person's points and sort the resulting table, which I can display in the Gallery. I just want to add a Ranking column to show what place each person is in. I think I need to use CountRows and Sequence somehow, but I'm not sure exactly what I need.

 

SortByColumns(
AddColumns(
GroupBy('2024PrismaticaQuestionHistory', ParticipantEmail, ParticipantName, GroupedScores),
'Total Points',
Sum(GroupedScores, Points)
),

"Total Points",
SortOrder.Descending
)

 

I'm still pretty new to PowerApps but what I'd like to do is assign the table returned by AddColumns to a variable and then operate on that, but I'm not sure how. Thanks for any help.

Categories:
I have the same question (0)
  • Verified answer
    TuongDoan Profile Picture
    573 Moderator on at

    First, collect you sorted table to a collection:

     

     

     

     

    ClearCollect(RankedTable,SortByColumns(
     AddColumns(
     GroupBy('2024PrismaticaQuestionHistory', ParticipantEmail, ParticipantName, GroupedScores),
     'Total Points',
     Sum(GroupedScores, Points)
     ), 
     "Total Points",
     SortOrder.Descending
    ))

     

     

     

     

    Then add indexes,

     

     

     

    ForAll(
     RankedTable,
     Collect(
     Indexed,
     {
     id: CountRows(Indexed) + 1,
     Value: Value
     }
     )
    );

     

     

     

     

    Then put the table Indexed in Gallery's item property

     

     

    ---------------------------

    If the solution I provided assisted you in resolving this issue, kindly select "Accept as solution" This will help others in finding the solution more expediently 😄Also, a Thumbs up would be a great compliment!

     

     

  • skiingdave Profile Picture
    24 on at

    Thanks, @TuongDoan . I understand how it's supposed to work (I think). I put all this in the screen's OnVisible handler. PowerApps complains that the second "Value" in the Value: Value line isn't valid (Name not recognized). I tried changing that to ThisRecord but that also doesn't seem to work.

     

    I also did 

    ForAll(
        RankedScoreTable,
        Collect(
            Indexed,
            {
                id: CountRows(Indexed) + 1,
                name: ThisRecord.ParticipantName,
                totalpoints: ThisRecord.'Total Points'      
            }
        )
    );

    But this resulted in a blank gallery. The gallery's Items is set to Indexed.

     

     

  • skiingdave Profile Picture
    24 on at

    Wait! I just needed to refresh the page so the OnVisible would fire.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard