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
Anonymous
Not applicable

¿Cómo puedo obtener el segundo valor más alto o más bajo?

Hola

Tengo un proceso que devuelve varios valores de fecha y hora para el mismo número de control. Por ejemplo:

número de fila fecha/hora

1 1234 24/08/2020 10:12

2 1234 24/08/2020 11:25

3 1234 24/08/2020 11:48

4 1234 24/08/2020 12:36

Necesito una medida que reconozca el valor más antiguo y el más antiguo para el mismo número de control y calcule la diferencia entre entonces. En este caso están en las filas número 1 (más antiguo) y 2 (segundo más antiguo) y la diferencia es 01:13 (puede ser en minutos también, 01:13 a 73 minutos).

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@lucasstelet

Por favor, pruebe esto

Measure = 
VAR _MIN=MIN('Table'[date/time])
VAR _SECMIN=MINX(FILTER('Table','Table'[date/time]>_MIN),'Table'[date/time])
RETURN DATEDIFF(_MIN,_SECMIN,MINUTE)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@lucasstelet


Pruebe esta medida por favor:

Difference = 
VAR _MIN = 
    CALCULATE(
        MIN(CONTROL[Date]),
        ALLEXCEPT(CONTROL,CONTROL[Number])
    )

VAR _MIN2 = 
    CALCULATE(
        MIN(CONTROL[Date]),
        CONTROL[Date] > _MIN,
        ALLEXCEPT(CONTROL,CONTROL[Number]))    
RETURN
DATEDIFF(
    _MIN,
    _MIN2,
    MINUTE
)

________________________

¿He respondido a tu pregunta? Marque este post como una solución, esto ayudará a otros!.

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

ryan_mayu
Super User
Super User

@lucasstelet

Por favor, pruebe esto

Measure = 
VAR _MIN=MIN('Table'[date/time])
VAR _SECMIN=MINX(FILTER('Table','Table'[date/time]>_MIN),'Table'[date/time])
RETURN DATEDIFF(_MIN,_SECMIN,MINUTE)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@lucasstelet , Probar como

datediff(maxx(filter(table,[number] á earlier([number]) && [row] ?earlier([row])-1 ),[date/time]), [date/time],minute)

Asunción número de fila continua

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.