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.
Hola, buen dia, quisiera que me ayuden en resolver un percanse que tengo, quiero calcular la duracion trabajada por cada item que tengo en la columna "numero". adjunto imagen
cabe mencionar que hay casos que iniciamos a las 23:00 H entonces quesiera que me calcule la duracion hasta las 00:00 "media noche" porque quiero la duracion por fecha.
estoy empezando a usar powerbi, y quisiera de su ayuda para poder resorverlo.
gracias de antemano por su ayuda...
Link del archivo 👉 https://drive.google.com/file/d/1inyAtaHcttZ5UVYdbEHq7k4oPOT8Iz0Z/view?usp=sharing https://drive.google.com/file/d/1inyAtaHcttZ5UVYdbEHq7k4oPOT8Iz0Z/view?usp=sharing
Solved! Go to Solution.
Power BI has no concept of a row number, and your data is missing an index column. At the very minimum you need to add that index column.
Your source data seems to have issues too, with multiple "Fin" events per "Inicio"
Here is a general idea of how your measure could work, after you corrected the data quality issues.
worked =
-- continuing?
var a = min('Reservorios Horas'[Index])
var b = CALCULATE(min('Reservorios Horas'[Tabla3.Status]),'Reservorios Horas'[Index]=a)
var c = if(b="Fin",CALCULATE(sum('Reservorios Horas'[Time]),'Reservorios Horas'[Index]=a),0)
-- full pairs
var d = filter('Reservorios Horas','Reservorios Horas'[Tabla3.Status]="Inicio")
var e = ADDCOLUMNS(d,"T",var i = [Index] return calculate(max('Reservorios Horas'[Time]),'Reservorios Horas'[Index]=i+1),
"D",var i = [Index] return calculate(max('Reservorios Horas'[Date]),'Reservorios Horas'[Index]=i+1))
var f = filter(e,[Date]=[D])
var f1 = sumx(f,[T]-[Time])
-- extending into the night?
var g = max('Reservorios Horas'[Index])
var h = CALCULATE(min('Reservorios Horas'[Tabla3.Status]),'Reservorios Horas'[Index]=g)
var j = if(h="Inicio",1-CALCULATE(sum('Reservorios Horas'[Time]),'Reservorios Horas'[Index]=g),0)
return 24*(c + f1 + j)
Power BI has no concept of a row number, and your data is missing an index column. At the very minimum you need to add that index column.
Your source data seems to have issues too, with multiple "Fin" events per "Inicio"
Here is a general idea of how your measure could work, after you corrected the data quality issues.
worked =
-- continuing?
var a = min('Reservorios Horas'[Index])
var b = CALCULATE(min('Reservorios Horas'[Tabla3.Status]),'Reservorios Horas'[Index]=a)
var c = if(b="Fin",CALCULATE(sum('Reservorios Horas'[Time]),'Reservorios Horas'[Index]=a),0)
-- full pairs
var d = filter('Reservorios Horas','Reservorios Horas'[Tabla3.Status]="Inicio")
var e = ADDCOLUMNS(d,"T",var i = [Index] return calculate(max('Reservorios Horas'[Time]),'Reservorios Horas'[Index]=i+1),
"D",var i = [Index] return calculate(max('Reservorios Horas'[Date]),'Reservorios Horas'[Index]=i+1))
var f = filter(e,[Date]=[D])
var f1 = sumx(f,[T]-[Time])
-- extending into the night?
var g = max('Reservorios Horas'[Index])
var h = CALCULATE(min('Reservorios Horas'[Tabla3.Status]),'Reservorios Horas'[Index]=g)
var j = if(h="Inicio",1-CALCULATE(sum('Reservorios Horas'[Time]),'Reservorios Horas'[Index]=g),0)
return 24*(c + f1 + j)
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 |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
76 | |
53 | |
46 | |
16 | |
12 |