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
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)
Cualquier ayuda es muy apreciada.
Gracias
Solved! Go to Solution.
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"
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" )
)
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"
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])
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.