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 / Help with calculating ...
Power Apps
Unanswered

Help with calculating hours worked through my Time Tracker app

(0) ShareShare
ReportReport
Posted on by 67

I have followed @RandyHayes's guide on how to build a Time Tracker app thoroughly. I have customized it to my company's liking and it works wonders. But now I need to use its SharePoint list data to generate reports on how much time each employee worked every month. I'm having a hard time with it because every Activity Type is in the same column so it is not as simple as "column A - column B - 1 = hours worked". I have tried using Power BI, but haven't had any success. I know this video is 2 years old but there is this comment on it asking about this exact scenario, to which he says:

 

"In general though, you could just do a calculation on the final close and write that into the list." 

 

How would I apply this to the app? 

 

Thank you in advance for the answers.

Categories:
I have the same question (0)
  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi @vinidegrandi can you give an example of what your data look like and what you want from it. 

  • vinidegrandi Profile Picture
    67 on at

    Yes, of course! So basically the data looks like this:

    vinidegrandi_0-1671537629677.png

     

    I've simplified the types into 1 (Check In), 2 (Lunch Out), 3 (Lunch In) and 4 (Check Out). What I need to calculate is all in the third column, where the time each activity was done is recorded. So in this picture he would've worked 8 hours total (18 - 9 - 1). I need to do this for the entire month for each employee. 

  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi @vinidegrandi 

     

    you could use this as a base:

    1. Group your data by date and email 
    2. Add a column to the hours work to the group

    Like this:

    data: colVini {activityType: , activityTime: , activityDate: , email:}

    GroupBy(colVini, "activityDate", "email", "Per Day")

    Then add a column. the four context variables correspond to your type

    AddColumns(GroupBy(colVini, "activityDate", "email", "Per Day"), "Hours", 
     With(
     {
     ctxCheckIn: LookUp('Per Day', activityType = 1).activityTime,
     ctxLunchOut: LookUp('Per Day', activityType = 2).activityTime,
     ctxLunchIn: LookUp('Per Day', activityType = 3).activityTime,
     ctxCheckOut: LookUp('Per Day', activityType = 4).activityTime
     },
     
     DateDiff(ctxCheckIn, ctxLunchOut, Hours) + DateDiff(ctxLunchIn, ctxCheckOut, Hours)
     )
    )

     

    Result

    Collection:

    rubin_boer_0-1671547319180.png

     

    Gallery with Items = colVini

    rubin_boer_1-1671547363339.png

     

    Let's group and add the columns as per the code above

    rubin_boer_2-1671547433082.png

     

    So from data above

     

    rubin_boer_3-1671547462284.png

     

    lets add another person (email)

     

    rubin_boer_4-1671547747590.png

     

     

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