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 fetch record on...
Power Apps
Answered

How to fetch record on specific calculation from the list of records ?

(0) ShareShare
ReportReport
Posted on by 60

Hello,

 

I have list of records as follows in datasource:

 

Item         Text        Num

Item 1Text 13
Item 2Text 22
Item 2Text 34
Item 1Text 46

 

I want to perform following operations using formula:

 1. Group by Items:

 

Item 1Text 13
Item 1Text 46
   
Item 2Text 22
Item 2Text 34

     

 2. sum Num of grouped item

Item 1Text 13
Item 1Text 46
  sum= 9
Item 2Text 22
Item 2Text 34
  sum=6

 

3. Sort by highest value of  sum of num 

Item        Num Sum

Item 1     9

Item 2     6

 

How can I bind the resulted values as indicated in 3. to list control ? ( Basically, I need distrinct records from the datasource sorted by highest value of thier numbers )

 

I could do group with ClearCollect, but I am stucked at step 2. and 3. - Any suggestions ?

 

Best Regards,

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @dips23 

    You mention "list control".  Are you referring to a Gallery?  Or are you talking about a List box?

    If you're looking at a Gallery type control, You can set the Items property of your control to the following:

    SortByColumns(
    AddColumns(
    GroupBy(yourDataSource, "Item", "Items"),
    "ItemSum", Sum(Items,Num)),
    "ItemSum",Descending)

    This will group the records and create a sum of each num within the distinct item.

     

    I've attached a sample app with this logic for you to review.

    I hope it is helpful for you.

     

  • dips23 Profile Picture
    60 on at

    Thank you so much for your time, It did workout for my datasource exactly the way I wanted 🙂 ! You are Awesome!

     

    Best Regards,

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard