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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors