Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 |
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.
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 56 | |
| 47 | |
| 44 | |
| 20 | |
| 20 |
| User | Count |
|---|---|
| 73 | |
| 72 | |
| 34 | |
| 33 | |
| 31 |