SOLVED

Calculating work hours

Copper Contributor

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?

 

new 6.PNG

 

 

 

 

4 Replies
best response confirmed by Broly123 (Copper Contributor)
Solution

@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.

 

screenshot.png

 

SP-List.png

 

Rob
Los Gallardos

@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?

 

SP.PNG

SP2.PNG

@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.

@Rob_Elliott Noted. I'm still getting a negative value. Is that the correct formula I'm using? and is there a tutorial on using Power Automate to calculate the hrs for the week?

SP3.PNG

1 best response

Accepted Solutions
best response confirmed by Broly123 (Copper Contributor)
Solution

@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.

 

screenshot.png

 

SP-List.png

 

Rob
Los Gallardos

View solution in original post