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.
Quiero crear una tabla de campos de fecha como resultado basada en varias condiciones.
Se trata de datos que contienen scheduled_tasks ejecuciones.
Datos que tengo:
Tarea | Fecha de inicio | Repita por | Repita cada |
Tarea 1 | 01-12-23 | Días | 1 |
Tarea 2 | 01-12-23 | Días | 2 |
basado en la repetición por y repetir cada , he creado una salida de fecha,
Condición:
La fecha de inicio de la tarea 1 es 01-12-23 y se ejecuta diariamente, por lo que la salida debe ser hasta la fecha de la tarea 1.
La fecha de inicio de la tarea 2 es 01-12-23, se ejecuta dos días una vez, por lo que la salida debe ser fechas alternativas para la tarea 2.
Resultado esperado | |
Tarea | Fecha |
Tarea1 | 01-12-23 |
Tarea 2 | 01-12-23 |
Tarea1 | 02-12-23 |
Tarea1 | 03-12-23 |
Tarea 2 | 03-12-23 |
Tarea1 | 04-12-23 |
Tarea1 | 05-12-23 |
Tarea 2 | 05-12-23 |
El resultado de la salida debería llegar hasta hoy. Si al día siguiente llega el basado en una condición, tenemos que mostrar qué tarea se ejecutará ese día.
Necesidad de crear una tabla hasta la fecha
No estoy seguro de cuándo desea tener la fecha de finalización para esto, pero intente lo siguiente:
{1..100}
Number.Mod ([Custom]/[repeat every] ,1) = 0
Complete el código a continuación:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkkszlYwVNJRUjAw1DU00jUyBrFTEiuLQbShUqwOVI0RLjVGSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Task " = _t, #"Start date" = _t, #"repeat by" = _t, #"repeat every" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Task ", type text}, {"Start date", type date}, {"repeat by", type text}, {"repeat every", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {1..100}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", Int64.Type}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "Custom.1", each Number.Mod ([Custom]/[repeat every] ,1) = 0 ),
#"Filtered Rows" = Table.SelectRows(#"Added Custom1", each ([Custom.1] = true))
in
#"Filtered Rows"
La última fecha debe ser una fecha today(). (19-dic-2023).
Si estoy mirando el informe de mañana, ese día debería ser una última fecha.
Simplemente cambie la fórmula de la lista por esta:
{0.. Number.From( Date.From (DateTime.LocalNow())- [Start date])}
Todo el resto del código es el mismo.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkkszlYwVNJRUjAw1DU00jUyBrFTEiuLQbShUqwOVI0RLjVGSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Task " = _t, #"Start date" = _t, #"repeat by" = _t, #"repeat every" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Task ", type text}, {"Start date", type date}, {"repeat by", type text}, {"repeat every", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {0.. Number.From( Date.From (DateTime.LocalNow())- [Start date])}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", Int64.Type}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "Custom.1", each Number.Mod ([Custom]/[repeat every] ,1) = 0 ),
#"Filtered Rows" = Table.SelectRows(#"Added Custom1", each ([Custom.1] = true)),
#"Added Custom2" = Table.AddColumn(#"Filtered Rows", "FInal Date", each [Start date] + #duration([Custom] ,0 , 0 , 0))
in
#"Added Custom2"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |