- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Calcular tiempo transcurrido considerando solo el horario laboral
Tengo un query que registra requerimientos de mantenimiento, algo parecido a la tabla muestra. Lo que necesito es calcular el tiempo transcurrido entre Created_Date y AssignedDate; AssignedDate y End_Date. El inconveniente está, en que necesito que se calcule solmente el horario laboral cuando una tarea tome mas de un dia en finalizarse, es decir, que se haga un corte de tiempo y se reanude al dia siguiente. El horario laboral es de 7:00 am a 4:30 pm. Sé que podría hacerlo con un condicionante pero si solo fuese un dia el que transcurre, no se me ocurre cómo hacerlo si el reporte permanece abierto mas de un dia.
Id | Created_Date | Requested_By | AssignedDate | Tentative_Date | End_Date | Technician | Status | Delay_date |
1855 | 7/1/2022 9:32 | Empleado 1 | 7/1/2022 12:56 | 7/4/2022 0:00 | 7/1/2022 13:46 | Mecanico 1 | Finalizado | |
1856 | 7/1/2022 15:32 | Empleado 2 | 7/2/2022 16:21 | 7/4/2022 0:00 | 7/5/2022 10:53 | Mecanico 2 | Finalizado | |
1857 | 7/4/2022 7:17 | Empleado 3 | 7/4/2022 8:47 | 7/4/2022 0:00 | 7/4/2022 13:55 | Mecanico 3 | Finalizado | |
1858 | 7/4/2022 7:20 | Empleado 4 | 7/4/2022 8:46 | 7/4/2022 0:00 | 7/4/2022 15:57 | Mecanico 4 | Finalizado | |
1859 | 7/4/2022 8:42 | Empleado 5 | 7/4/2022 8:46 | 7/4/2022 0:00 | 7/4/2022 15:58 | Mecanico 5 | Finalizado | |
1860 | 7/4/2022 9:07 | Empleado 6 | 7/4/2022 11:11 | 7/9/2022 0:00 | 7/20/2022 9:00 | Mecanico 6 | Finalizado | |
1861 | 7/4/2022 9:27 | Empleado 7 | 7/5/2022 10:23 | 7/4/2022 0:00 | 7/4/2022 13:55 | Mecanico 7 | Finalizado | |
1862 | 7/4/2022 9:28 | Empleado 8 | 7/5/2022 10:23 | 7/5/2022 0:00 | 7/4/2022 15:58 | Mecanico 8 | Finalizado | |
1863 | 7/4/2022 9:42 | Empleado 9 | 7/4/2022 10:22 | 7/4/2022 0:00 | 7/4/2022 14:01 | Mecanico 9 | Finalizado | |
1864 | 7/4/2022 11:13 | Empleado 10 | 7/4/2022 11:22 | 7/5/2022 0:00 | 7/5/2022 10:54 | Mecanico 10 | Finalizado |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, @Anonymous
You can try the following methods.
Difference1 =
Var _SECOND=DATEDIFF([Created_Date],[AssignedDate],SECOND)
Return
FORMAT ( ROUNDDOWN ( DIVIDE ( _SECOND, 3600 ), 0 ), "00" ) & ":"
& FORMAT ( ROUNDDOWN ( DIVIDE ( MOD ( _SECOND, 3600 ), 60 ), 0 ), "00" ) & ":"
& FORMAT ( MOD ( _SECOND, 60 ), "00" )
Difference2 =
Var _SECOND=DATEDIFF([AssignedDate],[End_Date],SECOND)
Return
FORMAT ( ROUNDDOWN ( DIVIDE ( _SECOND, 3600 ), 0 ), "00" ) & ":"
& FORMAT ( ROUNDDOWN ( DIVIDE ( MOD ( _SECOND, 3600 ), 60 ), 0 ), "00" ) & ":"
& FORMAT ( MOD ( _SECOND, 60 ), "00" )
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @v-zhangti thanks, but what I need is to make a count of elapsed time but only for working hours, from 7:00 am to 4:30 pm. If the task is not completed on one day I need to make a cut of time for a time value >4:30 pm to <7:00 am, for each day till the task is completed. Also, I forgot to add that I need to exclude weekends as well

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
12-31-2024 07:00 PM | |||
12-31-2019 08:24 AM | |||
10-18-2024 03:05 PM | |||
Anonymous
| 02-07-2023 04:49 PM | ||
01-02-2025 05:02 AM |
User | Count |
---|---|
136 | |
106 | |
88 | |
56 | |
46 |