Employee hours worked report

Hi! I am worked on a timesheet report for weekly hours worked for a group of field technicians. I have created a slice that filters the punch in/punch out times for each employee. A report prints every Monday showing the work times for each day the previous week. This all works. I have a virtual column in the timesheet table that calculates the total hours worked for each employee the previous week. This also outputs the correct info. This issue I have is that that โ€œTotal hours workedโ€ prints out in the report the same number of times as the number of rows in the report. So, for example, if the employee had 5 days of punch in and out times the previous week, the total number of hours for those 5 days will print out 5 times. Is there a way to print out the sum once instead of printing to match the number of rows in the report?

Thanks!

Justin

Solved Solved
0 6 822
1 ACCEPTED SOLUTION

Can you try the following.

 <<Start:FILTER(Total hours worked in past week for Rob, true)>> 
 Date: <<[Date]>> Time in: <<[Time in]>> Time out: <<[Time out]>> 
 <<End>>

 Total hours: <<SUM(SELECT(Timesheet[Number of hours], AND(([Employee name]=โ€œRob Grawbergerโ€), ([Date] > (TODAY() - WEEKDAY(TODAY()))), ([Date] <= (TODAY() - WEEKDAY(TODAY())) + 7))))>>

I am not very good with expressions, but I think your expression will compute the total correctly if you put it in the Report template (as shown above). If so, and if you donโ€™t use that virtual column elsewhere, it would be better to compute the total in the Report and eliminate the virtual column from the slice.

View solution in original post

6 REPLIES 6

Can you show us the Report template you are using?

Hi Phil, yes sir, here is the link:

Thanks,

Justin

Everything between the <<Start>> and <<End>> is repeated for each record returned by the <<Start>> expression. That is why you are seeing the total repeated for each record. You need to remove it from its current location to prevent it from being displayed for each recordโ€ฆ

I am not sure how you are computing the total, but essentially you want to put โ€œTotal hours:โ€ and the expression that computes that total after the <<End>>.

Hi Phil, thanks for the feedback. I tried this now but if I move the [Total hours past week Rob] after the <> the report wonโ€™t send at all.

[Total hours past week Rob] is a virtual column in my Timesheet table calculated via:

SUM(SELECT(Timesheet[Number of hours], AND(([Employee name]=โ€œRob Grawbergerโ€), ([Date] > (TODAY() - WEEKDAY(TODAY()))), ([Date] <= (TODAY() - WEEKDAY(TODAY())) + 7))))

I pull the virtual column into my Total hours worked in past week for Rob slice that Iโ€™m creating the report from.

Not sure if my structure has something to do with this?

Thanks,

Justin

Can you try the following.

 <<Start:FILTER(Total hours worked in past week for Rob, true)>> 
 Date: <<[Date]>> Time in: <<[Time in]>> Time out: <<[Time out]>> 
 <<End>>

 Total hours: <<SUM(SELECT(Timesheet[Number of hours], AND(([Employee name]=โ€œRob Grawbergerโ€), ([Date] > (TODAY() - WEEKDAY(TODAY()))), ([Date] <= (TODAY() - WEEKDAY(TODAY())) + 7))))>>

I am not very good with expressions, but I think your expression will compute the total correctly if you put it in the Report template (as shown above). If so, and if you donโ€™t use that virtual column elsewhere, it would be better to compute the total in the Report and eliminate the virtual column from the slice.

Thank you Phil! This worked like a charm, Iโ€™ve removed the virtual column from the slice as well! Thanks so much!

Top Labels in this Space