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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Determinar el cambio en función de TimeStamp

Hola a todos

Necesito ayuda para determinar el turno en función de la marca de tiempo de mi conjunto de datos.

Turno de día = 6:00:00 AM a 6:00:00 PM

Turno de noche = 6:00:00 PM a 6:00:00 AM (al día siguiente)

KevinJan_0-1651053344923.png

Cualquier ayuda es muy apreciada.

Gracias

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Hay @KevinJan ,

tal vez esto ayude.

if DateTime.Time([time]) > Time.From("6:00:00") and DateTime.Time([time]) < Time.From("18:00:00") then "Day Shift" else "Night Shift"

shiftPQ.png

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

columna=
VAR _A =
TIEMPO ( 6,00,00 )
VAR _B =
TIEMPO ( 18,00,00 )

DEVOLUCIÓN
SI (
[Time Coulmn] >= _A
&& [Time Coulmn] <= _B,
"Turno de día",
IF ( [Time Coulmn] <= _A && [Time Coulmn] >= _A,"Night Shift" )
)

Syndicate_Admin
Administrator
Administrator

Hay @KevinJan ,

tal vez esto ayude.

if DateTime.Time([time]) > Time.From("6:00:00") and DateTime.Time([time]) < Time.From("18:00:00") then "Day Shift" else "Night Shift"

shiftPQ.png

Tal vez me equivoque, pero mientras busco una solución similar, creo que esto no es suficiente. He definido con éxito el turno de noche y de día por tiempo, pero ¿qué sucede cuando la última parte del turno de noche se contabiliza en el día equivocado? Por ejemplo, el turno de noche tiene 6 horas que ocurre a la mañana siguiente, pero debe contarse como el mismo turno que la noche en la que se inicia. ¿Esta fórmula explica eso?

Hola @villasenorbritt ,
para este requisito debe calcular otra columna que le indicará la fecha en que se cuenta el valor.

if DateTime.Time([time]) <= Time.From("6:00:00") then DateTime.Date([time]) - #duration(1,0,0,0) else DateTime.Date([time])

ShiftDate.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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