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 Automate / Grouping by Employee a...
Power Automate
Answered

Grouping by Employee and Weekly Hours

(0) ShareShare
ReportReport
Posted on by 47

I want to build an MS Flow which would organize the List data by Employee and then tabulate the Employees monthly total hours and post the hours in an HTML table, then process the next Employee.  

I already have a list that captures the Employee hours each week and captures the total hours for that week.  

Might there be an example which would show how to group by Employee and then further group by total hours?  I am assuming this will be two Apply to Each action which first passes in the employee as a set into the next.  But I am not clear how to organize this into HTML as we have 5 employees.  All the data has to appear in an email as the accountant likes that format. 

Categories:
I have the same question (0)
  • jinivthakkar Profile Picture
    4,187 on at

    @3R-Automation I tried this not sure about your list schema, I have a week column so it can be used to filter week or you can also use month values from Jan to Dec and it is needed so we don't hit the threshold limit and get only limited records

    jinivthakkar_1-1620385914110.png

     

    jinivthakkar_0-1620385881269.png

    jinivthakkar_2-1620386035136.png

    jinivthakkar_3-1620386057591.png

    jinivthakkar_4-1620386086414.png

    You can also format and make the table more beautiful but I leave that to you, this is just high level approach you can make changes as per your use case.

     

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

    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

  • 3R-Automation Profile Picture
    47 on at

    Hours.jpg

     

     

    The inserted image is what the accountant would like the report to be organized like.  The employee hours data is in a list and does contain the hours for each day and the calculated total of the hours for the week.  What I need to do is to build a flow which passes in the Start Date and End Date and then groups the data by Employee, organizes the Start and End dates so they correspond by the Weeks in the month.  And then calculate the totals for each column based on the employee.  If I had hours during the month of January for employees:  Bob, John and Clint then the script should group the hours for Bob, John and Clint to do the calculations on totals and organize the hours into tables with the totals under each block.  

  • Verified answer
    jinivthakkar Profile Picture
    4,187 on at

    @3R-Automation this is what I have tried

    jinivthakkar_0-1620832866719.png

    jinivthakkar_1-1620832896937.png

    jinivthakkar_2-1620832931655.png

    In first Get items I have filter which is hard coded as highlighted 

    jinivthakkar_3-1620832979221.png

    then I create table and in second Get items I have filter which is hard coded with Jane then I create html table and then pass to Email action. You can repeat the same for other employees as well.

    You can work on formatting of email. 

     

    This is not the best approach but considering this is only for 5 employees I won't invest a lot of time/efforts. Also for total I have another flow (when item is created/updated) which would update total so in the above flow I can just extract the value of total.

    The total at the bottom of table for Monday, Tues etc is not possible.

     

    Hope this helps.

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

  • 3R-Automation Profile Picture
    47 on at

    Very nice, I never thought about using hard-coded employee names.  I was off on a tangent using JSON to collect all the hours and then figuring out how I would total.  But I could technically have an array of the employees and then have a loop that steps through that array and builds the HTML one at a time and emails them.  The Accountant is OK with having the employee hours sent one at a time, and that might be easier for her to tabulate.  I already can do a calculation of the total hours to produce a total.  

     

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 Automate

#1
Valantis Profile Picture

Valantis 411

#2
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 291

Last 30 days Overall leaderboard