Forum Discussion

Broly123's avatar
Broly123
Copper Contributor
Jun 27, 2023
Solved

Calculating work hours

Hello! I have created a clock in system for power apps using SharePoint as a data source and I want to be able to add up the total hrs worked for the day as well as for the week. The issue I have is creating a formula to calculate the hours on SharePoint because we made the date and time auto populate when employees clock in and allowed employees to choose which action they were taking (Punch In/Punch Out) Is there a formula where I can use to add the hours using the inputs and date and time columns?

 

 

 

 

 

  • Broly123  you can't do it that way because a calculated column can only look at the columns in the same item, not across different items. It would be best to have the Punch In and Punch Out columns in the same item. As you've mentioned Power Apps, you could do the calculation in Power Apps then patch the hours to an item in the SharePoint list.

     

     

     

    Rob
    Los Gallardos

4 Replies

  • Rob_Elliott's avatar
    Rob_Elliott
    Bronze Contributor

    Broly123  you can't do it that way because a calculated column can only look at the columns in the same item, not across different items. It would be best to have the Punch In and Punch Out columns in the same item. As you've mentioned Power Apps, you could do the calculation in Power Apps then patch the hours to an item in the SharePoint list.

     

     

     

    Rob
    Los Gallardos

    • Broly123's avatar
      Broly123
      Copper Contributor

      Rob_Elliott Thanks for the reply! I went ahead and changed it. I seem to have a problem with my formula for total worked hours that day with a 30 min lunch break. And how would I calculate for total hrs that week?

       

      • Rob_Elliott's avatar
        Rob_Elliott
        Bronze Contributor

        Broly123 your endtime is empty which is why you have the problem.To calculate the hours for the week you'd either need columns for each day of the week (because a calcaulated column can only look at the same item, not across different items) or you'd need a flow in Power Automate.

Resources