cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## 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.

2 REPLIES 2
Community Support

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.

Anonymous
Not applicable

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors