The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hola a todos, por favor su ayuda.
Tengo el siguiente dataset con el comportamiento de unos sensores; la tabla muestra la fecha y hora en el que el sensor se apaga (Down) y cuando se enciende (UP).
El data set es el siguiente:
Name | Event Type Name | Event Time |
Local | Node Down | 29/06/2023 17:35 |
Local | Node Up | 29/06/2023 20:25 |
Local | Node Down | 1/07/2023 23:03 |
Local | Node Up | 1/07/2023 23:05 |
Local | Node Down | 3/07/2023 19:29 |
Local | Node Up | 3/07/2023 19:31 |
Local | Node Down | 3/07/2023 21:37 |
Local | Node Up | |
Local | Node Down | 5/07/2023 18:56 |
Local | Node Up | 5/07/2023 18:59 |
Local | Node Down | 6/07/2023 15:56 |
Por favor su ayuda, Se requiere calcular la diferencia entre las dos fechas para cada uno en el que se pueda realizar la operacion y al finalizar sumar el total de tiempo en el que sesnsor estuvo apgado, de esta forma como se muestra en la siguiente tabla:
Name | Node Down | Node Up | Diferencia( segundos) |
Local | 29/06/2023 17:35 | 29/06/2023 20:25 | 10246,28 |
Local | 1/07/2023 23:03 | 1/07/2023 23:05 | 156,10 |
Local | 3/07/2023 19:29 | 3/07/2023 19:31 | 135,11 |
Local | 3/07/2023 21:37 | ||
Local | 5/07/2023 18:56 | 5/07/2023 18:59 | 161,24 |
Local | 6/07/2023 15:56 | ||
Total | 10698,733 |
Nota:
Como se puede observar algunas veces el sensor solo registra un estado o UP o Down, este se omitira ya que no se puede realizar la operacion matematica de la diferencia.
Solved! Go to Solution.
Hi @Diego_F ,
Here are the steps you can follow:
1. In Power Query -- Add Column – Index Column – From 1.
2. Add Column – Conditional Column .
3. Select [Custom] – Fill -- Down.
4. Select [Index] – Remove.
5. Select [Name] and [Custom] – Merge Columns.
6. Select [Event Type Name] – Transform – Pivot Column.
7. Result:
Your [Diferencia(segundos)] is not very clear how it came about, and the difference between the two dates I got using the DATEDIFF() function is the following:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Diego_F ,
Here are the steps you can follow:
1. In Power Query -- Add Column – Index Column – From 1.
2. Add Column – Conditional Column .
3. Select [Custom] – Fill -- Down.
4. Select [Index] – Remove.
5. Select [Name] and [Custom] – Merge Columns.
6. Select [Event Type Name] – Transform – Pivot Column.
7. Result:
Your [Diferencia(segundos)] is not very clear how it came about, and the difference between the two dates I got using the DATEDIFF() function is the following:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hello Yang.
Thank you, it was what I was looking for, I will implement it and I will inform you if any doubt appears.
@Diego_F , Try a measure like
Var _min = Maxx(filter(allselected(Table),Table[Name] = maX(Table[Name]) && Table[Event Time] > Max(Table[Event Time])), Table[Event Time])
var _type = Maxx(filter(allselected(Table),Table[Name] = maX(Table[Name]) && Table[Event Time]=_min && Table[Event Type] = "Up"), Table[Event Time])
return
if( Table[Event Type] = "Down", datediff(Max(Table[Event Time]) ,_min second))
Hola, gracias, estoy intentando agregarla pero el parametro:
if( unido[Event Type name] = "Node Down", datediff(Max(unido[Event Time]) ,_min second))
No logro ajustarlos, podria guiarme porfavor.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
77 | |
73 | |
47 | |
39 |
User | Count |
---|---|
137 | |
108 | |
69 | |
64 | |
56 |