web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Need Help with a numbe...
Power Apps
Unanswered

Need Help with a numbered Leader List

(0) ShareShare
ReportReport
Posted on by 55

This formula was working fine and now its crashing the app. I have a list that users cannot nominate people for special awards. The formula was working fine, but now I cant open the app without it crashing because of this formula.

 

Is there a better way to accomplish what I am trying to do?

 

 

 

 

ClearCollect(LeaderList, AddColumns(GroupBy(AddColumns(NominationsList, 
"NomineeName", Nominee.DisplayName, "NomineeFullname", Last(Split(Nominee.DisplayName,",")).Result & " " & First(Split(Nominee.DisplayName,",")).Result), 
"NomineeName","NomineeFullname", "GroupByUsersDisplayName"),"Total Noms", 
CountRows(GroupByUsersDisplayName),"TotalBadgeTypes", 
CountRows(Distinct(GroupByUsersDisplayName,BadgeType))));



Clear(LeaderList_Numbered);
ForAll(LeaderList, 
 Collect(LeaderList_Numbered,
 Last(FirstN(AddColumns(Sort(LeaderList, 'Total Noms', Descending),
 "RowNumber",
 CountRows(LeaderList_Numbered)+1
 ), 
 CountRows(LeaderList_Numbered)+1
 )
 ) 
 )
);

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @becca51180 ,

    It is always good to use Format Text on your code, so it appears as below (saves time for responders not needing to format), however two things - if the first bit is not working- firstly, a bit of a plunge - try this on the Items of your Gallery (free-typed, so please convey any errors)

    With(
     {
     wList:
     Sort(
     AddColumns(
     GroupBy(
     AddColumns(
     NominationsList, 
     "NomineeName", 
     Nominee.DisplayName, 
     "NomineeFullname", 
     Last(
     Split(
     Nominee.DisplayName,
     ","
     )
     ).Result & " " & 
     First(
     Split(
     Nominee.DisplayName,
     ","
     )
     ).Result
     ), 
     "NomineeName",
     "NomineeFullname", 
     "GroupByUsersDisplayName"
     ),
     "Total Noms", 
     CountRows(GroupByUsersDisplayName),
     "TotalBadgeTypes", 
     CountRows(
     Distinct(
     GroupByUsersDisplayName,
     BadgeType
     ).Result
     )
     ),
     'Total Noms', 
     Descending
     )
     },
     ForAll(
     Sequence(CountRows(wList)),
     Patch(
     Last(
     FirstN(
     wList,
     Value
     )
     ),
     {RowNumber: Value}
     )
     )
    )

    Winding back a bit - your two collections

    ClearCollect(
     LeaderList,
     AddColumns(
     GroupBy(
     AddColumns(
     NominationsList, 
     "NomineeName", 
     Nominee.DisplayName, 
     "NomineeFullname", 
     Last(
     Split(
     Nominee.DisplayName,
     ","
     )
     ).Result & " " & 
     First(
     Split(
     Nominee.DisplayName,
     ","
     )
     ).Result
     ), 
     "NomineeName",
     "NomineeFullname", 
     "GroupByUsersDisplayName"
     ),
     "Total Noms", 
     CountRows(GroupByUsersDisplayName),
     "TotalBadgeTypes", 
     CountRows(
     Distinct(
     GroupByUsersDisplayName,
     BadgeType
     ).Result
     )
     )
    );
    Clear(LeaderList_Numbered); 
    With(
     {
     wList: 
     Sort(
     Devices,
     'Total Noms',
     Descending
     )
     },
     ForAll(
     Sequence(CountRows(wList)),
     Collect(
     LeaderList_Numbered,
     Patch(
     Last(
     FirstN(
     wList,
     Value
     )
     ),
     {RowNumber: Value}
     )
     )
     )
    )

     

    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.

  • becca51180 Profile Picture
    55 on at

    This is great! I think the list is too long but your solution is working better than mine. Is there a way to only number the top 25?

  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @becca51180 

    If you only want to number the first 25, just replace with this

    ForAll(
     Sequence(CountRows(wList)),
     . . . . . 

    with this

    ForAll(
     Sequence(25),
     . . . . 

    or if you only want the first 25 records to display

    With(
     {
     wList:
     FirstN(
     Sort(
     AddColumns(
     GroupBy(
     AddColumns(
     NominationsList, 
     "NomineeName", 
     Nominee.DisplayName, 
     "NomineeFullname", 
     Last(
     Split(
     Nominee.DisplayName,
     ","
     )
     ).Result & " " & 
     First(
     Split(
     Nominee.DisplayName,
     ","
     )
     ).Result
     ), 
     "NomineeName",
     "NomineeFullname", 
     "GroupByUsersDisplayName"
     ),
     "Total Noms", 
     CountRows(GroupByUsersDisplayName),
     "TotalBadgeTypes", 
     CountRows(
     Distinct(
     GroupByUsersDisplayName,
     BadgeType
     ).Result
     )
     ),
     'Total Noms', 
     Descending
     ),
     25
     ) 
     },
     ForAll(
     Sequence(CountRows(wList)),
     Patch(
     Last(
     FirstN(
     wList,
     Value
     )
     ),
     {RowNumber: Value}
     )
     )

     

    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.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @becca51180 ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

    Visit my blog Practical Power Apps

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard