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 calcular el tiempo promedio entre las fechas. Los datos se ven así:
Paso | Fecha y hora |
2 | 14.11.2022 13:02:56 |
4 | 14.11.2022 13:05:15 |
2 | 14.11.2022 13:11:23 |
4 | 14.11.2022 13:13:38 |
2 | 14.11.2022 13:24:03 |
4 | 14.11.2022 13:26:21 |
2 | 15.11.2022 12:16:58 |
4 | 15.11.2022 12:19:28 |
Necesito obtener un tiempo promedio entre todos los pasos número 4 y stpes número 2.
14.11.2022 13:05:15 - 14.11.2022 13:02:56 = 00:02:19
14.11.2022 13:13:38 - 14.11.2022 13:11:23 = 00:02:15
14.11.2022 13:26:21 - 14.11.2022 13:24:03 = 00:02:18
15.11.2022 12:19:28 - 15.11.2022 12:16:58 = 00:02:30
El promedio entre los cuatro es igual a 00: 02:20
Cuando uso la fórmula medida = CALCULATE(SUM(Logging[CreatedAt]),Logging[Step] = 4) - CALCULATE(SUM(Logging[CreatedAt]),Logging[Step] = 2) calcula el total de las cuatro filas.
El resultado de la fórmula anterior 30.12.1899 0:09:22
(Por cierto, ¿cómo deshacerse de este extraño resultado de fecha 30.12.1899?)
Si utilizo la fórmula measure = AVERAGEX(Logging, CALCULATETABLE(VALUES(Logging[CreatedAt]), FILTER(Logging, Logging[Step] = 4)) - CALCULATETABLE(VALUES(Logging[CreatedAt]), FILTER(Logging, Logging[Step] = 4))) no entrega nada.
Hi, @bombom
Para sus necesidades, deberá convertir la diferencia a "segundos", tomar el promedio y convertir el resultado al formato de tiempo.
Por favor, pruebe la fórmula de medida como:
EndAt =
IF (
MAX ( Logging[Step] ) = 2,
CALCULATE (
MIN ( Logging[CreatedAt] ),
FILTER ( ALL ( Logging ), Logging[CreatedAt] > MAX ( Logging[CreatedAt] ) )
),
BLANK ()
)
diff(second) = DATEDIFF(MAX(Logging[CreatedAt]),[EndAt],SECOND)
Average = AVERAGEX(Logging,[diff(second)])
Result1 =
IF (
[Average] = BLANK (),
BLANK (),
TIME ( 0, 0, FLOOR ( 'Souktion1'[Average], 1 ) )
)
Si el resultado total es 30.12.1899 0:09:22, solo necesita cambiar el formato de su medida.
Resultado:
Referencia:
Saludos
Equipo de Apoyo a la Comunidad _ Eason
@bombom , Pruebe una medida como
AVERAGEX(Tabla,
var _max = maxx(filter(Table, Table[Datetime] < before([Datetime]) && [Step] =2),[Datetime])
devolución
if([Step] =4,datediff(_max,[Datetime],second) ,blank())
)
o
tiempo(0,0,0) + PROMEDIOX(Tabla,
var _max = maxx(filter(Table, Table[Datetime] < before([Datetime]) && [Step] =2),[Datetime])
devolución
if([Step] =4,datediff(_max,[Datetime],second) ,blank())
)/(3600*24)
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 | |
2 | |
2 | |
2 | |
1 |