Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
TatyDo
Helper III
Helper III

Calcular período

Hallo todos,

Si tengo esta tabla y quiero calcular para cada ID la duración entre la hora de finalización y la hora de inicio del siguiente evento.

En la columna marcada en verde está el valor que quiero calcular.

time between.jpg

¿Podrías por favor que salga?

Sé que dateiff calculará, pero sólo en el mismo crudo, pero lo que necesito está en diferentes filas.

1 REPLY 1
v-xicai
Community Support
Community Support

Hola @TatyDo ,

Puede crear columna y medir como DAX a continuación.

Column:

Rank= RANKX(FILTER(Table1,Table1[ID]=EARLIER(Table1[ID])),Table1[Event time],,ASC)



Measure:

DiffTime=

Var _FirstTime=  CALCULATE(MIN(Table1[Event time]),FILTER(ALLSELECTED(Table1), Table1[ID] =MAX(Table1[ID]) &&Table1[Rank] =MAX(Table1[Rank])))

Var _SecondTime= CALCULATE(MIN(Table1[Start time]),FILTER(ALLSELECTED(Table1), Table1[ID] =MAX(Table1[ID]) && Table1[Rank] =MAX(Table1[Rank])+1))

Return

DATEDIFF(_FirstTime, _SecondTime, MINUTE )

Saludos

Amy

Equipo de apoyo a la comunidad _ Amy

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.