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 / Using Sum and GroupBy ...
Power Apps
Answered

Using Sum and GroupBy to retrieve the person with the most hours

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi.

I have a list of Employees and I'd like to retrieve which one has done the most hours. I want to Group the list by 'Prénom et nom', then calculate the sum of 'Heures' and to finish with I'd like to calculate the maximum using the Max functions. Then I can compare which employee is in the returned collection and know which one of them has done the most hours.

 

I know what I want and the steps to achieve it, but since I'm new to PowerApps I don't really know in what order I have to procede.

Thanks a lot ! Here's a screenshot of a part of my sharepoint list. And after, the type of collection I'd like to retrieve.

 

NoahBlanchard_0-1651864352433.png

 

Name and surname... other columns ...Sum of the hours
Alexandre Sommer...The sum of his hours
Alec Pelletier-Dubuc...The sum of his hours

 

Categories:
  • Verified answer
    slerch Profile Picture
    59 on at

    Whether you use a gallery or a ClearCollect statement, the items will look something like this

    Sort(
     AddColumns(
     GroupBy(
     SpListName,
     "Name", // any number of columns can be used for your Group By
     "Hours" // this column is a table of hours
     ),
     "totalHours",
     Sum(
     Hours,
     Hours
     )
     ),
     totalHours,
     Descending
    )

    This will give you the sum of all the hours (after being grouped by your selected columns) and sort it with the most hours on top.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks a lot ! unfortunately I can't try right now but as asson as I implement your solution I'll accept it (if it works but what I'm seeing seems correct so there shouldn't be any problem)

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 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard