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 / Using clear collect to...
Power Apps
Answered

Using clear collect to collect the FirstN item in a gallery

(0) ShareShare
ReportReport
Posted on by 35

Hi guys,

 

ClearCollect(30seconds, FirstN(Sort(BrowseGallery1.AllItems, 'Sum of Value', SortOrder.Descending),1));

 

Trying to collect the largest sum of value by sorting descending and collecting firstN limited to 1. Something is amiss. Help appreciated.

 

 

{Update: Fixed - Syntax for collection}

 

ClearCollect(Col30seconds, FirstN(Sort(BrowseGallery1.AllItems, 'Sum of Value', SortOrder.Descending),1));

 

Many thanks

Categories:
I have the same question (0)
  • Verified answer
    v-mengmli-msft Profile Picture
    on at

    Hi @Jake_Daniels_9 ,

     

    Do you want to collect items in gallery with largest sum of value?

    Please try this:

    ClearCollect(30seconds, Filter(BrowseGallery1.AllItems, 'Sum of Value'=Max(BrowseGallery1.AllItems,'Sum of Value'))

     

    Best regards,

    Rimmon

  • Jake_Daniels_9 Profile Picture
    35 on at

    This did work except not as well as I expected 😞

     

    How do I show the max sum of value in the gallery?

     

    I tried this but it doesn't work,

     

    Onvisible for my first form I collect the data from the source SPlist.

     

    2nd form,

     

    Grouped by teams and score/

     

    AddColumns(
    GroupBy(Filter('Col30secs','Score Date'>=Today()-90),"TeamAliasText", "GroupedItems"),
    "Sum of Value",
    Max(Sum(GroupedItems,Points)))

     

     

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard