Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
FransArnaud
Regular Visitor

how do I calculate the total working time per day, per week, per year

I have a table with different times for different technicians each day. I would like to calculate the total worked time per day per technician, per week, per month, and per year. What is the correct DAX formula for this? I already have several calculations. The total time per day per technician seems to be correct. However, when I try to display this in a matrix table per week or per month, it doesn't sum up the times. It keeps looking at the first time and the last time per period. Who has a suitable solution?

Example:

FransArnaud_0-1701077729544.png

 

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

Does you column have a time data type?

Time data types have a maximum of 24hrs. 

So if you add 23 + 2 = 1 and not 25!

And 8 + 8 + 8 + 8 + 8 = 16 and not 40.

Try using a decimal data type.

 

View solution in original post

3 REPLIES 3
speedramps
Community Champion
Community Champion

Does you column have a time data type?

Time data types have a maximum of 24hrs. 

So if you add 23 + 2 = 1 and not 25!

And 8 + 8 + 8 + 8 + 8 = 16 and not 40.

Try using a decimal data type.

 

To find the first time of the day per technician:

  • Min Time StartArbeid = MIN(PTS_Z14IT_CRM_HR_DAT[StartArbeid])
  • Min Time StartReisHeen = MINX(FILTER(PTS_Z14IT_CRM_HR_DAT,PTS_Z14IT_CRM_HR_DAT[StartReisHeen] <> 0 ),PTS_Z14IT_CRM_HR_DAT[StartReisHeen])
  • Min Time = MINX({[Min Time StartReisHeen],[Min Time StartArbeid]},[Value])

To find the last time of the day per technician:

  • Max Time TijdEindeArbeid = MAX(PTS_Z14IT_CRM_HR_DAT[EindeArbeid])
  • Max Time EindeReisTerug = MAX(PTS_Z14IT_CRM_HR_DAT[EindeReisTerug])
  • Max Time = MAXX({[Max Time EindeReisTerug],[Max Time TijdEindeArbeid]},[Value])

To find the total working time per day per technician:

  • Totale tijd min = CALCULATE(DATEDIFF([Min Time],[Max Time],MINUTE)) //
  • Totale tijd uur = [Totale tijd min]/60

 

Then the ‘Totale tijd min’ provides the total working time in minutes per day. When I place this as a value in a matrix table, I get an incorrect calculation of the total time. Also, when I try to see the total working time per week, I do not get accurate results.

 

FransArnaud_0-1701120138551.png

 

I have a solution. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.