# Total hours worked over a period of time

**URL:** <https://forums.knack.com/t/total-hours-worked-over-a-period-of-time/8773>\
**Category:** Get Answers\
**Created:** [July 20, 2020, 4:42am UTC](https://forums.knack.com/t/total-hours-worked-over-a-period-of-time/8773 "2020-07-20T04:42:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BookyAdela43970](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@BookyAdela43970](https://forums.knack.com/u/BookyAdela43970)\
**Post date:** [July 20, 2020, 4:42am UTC](https://forums.knack.com/t/total-hours-worked-over-a-period-of-time/8773/1 "2020-07-20T04:42:54Z")

</div>

The scenario:

In a monthly payroll scenario, where the payroll period is from the 25th of one month to the 24th of the next month, a staff member works a varied number of hours each day and worked for a number of days within the payroll period.

There are also a number of staff members working under the same circumstances - that is, working a number of hours each day for a number of days during a payroll period

How do I calculate in Knack the total number of hours worked "per payroll period" "per staff member"?

Note 1 - the staff member submits a timesheet each day recording the total number of hours they've worked for that day.

Note 2 - I have created objects for Staff Members, Pay Periods, Timesheet, Timecard etc.

This can be done in Excel as shown here [https://exceljet.net/formula/get-work-hours-between-dates](https://exceljet.net/formula/get-work-hours-between-dates)&nbsp;- so looking to be able to do same in Knack.

Also, I've tried the netWorkDays function in Knack but it keeps returning the wrong output:

![](upload://auTfPdJFAEkKjxGeEZL1Pbh8ujZ.png)

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![JulianSwal10732](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@JulianSwal10732](https://forums.knack.com/u/JulianSwal10732)\
**Post date:** [July 24, 2020, 12:54pm UTC](https://forums.knack.com/t/total-hours-worked-over-a-period-of-time/8773/2 "2020-07-24T12:54:04Z")

</div>

Just add a Sum field.&nbsp;

![](upload://1e0iVWm65v69kCj2zNDrceGyRho.png)

&nbsp;

Julian

---

<div class="post-metadata">

**Author:** ![BookyAdela43970](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@BookyAdela43970](https://forums.knack.com/u/BookyAdela43970)\
**Post date:** [July 23, 2020, 11:11pm UTC](https://forums.knack.com/t/total-hours-worked-over-a-period-of-time/8773/3 "2020-07-23T23:11:36Z")

</div>

Hi Julian, could you please give me an idea of the types of fields you added in the pay period record for each employee that summarise the records? I think I already have the master pay period record/object that you mentioned. Thanks very much!

---

<div class="post-metadata">

**Author:** ![JulianSwal10732](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@JulianSwal10732](https://forums.knack.com/u/JulianSwal10732)\
**Post date:** [July 23, 2020, 7:19pm UTC](https://forums.knack.com/t/total-hours-worked-over-a-period-of-time/8773/4 "2020-07-23T19:19:48Z")

</div>

Well I've done this by having a pay period record for each employee and then adding fields in there that summarize the time records.. Since the Time records are attached to the pay period, it gives you that value.. Then you could have the employee pay period records attached to a master pay period record with again summarization fields..&nbsp;

&nbsp;

Julian&nbsp;
