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

Tiempo más rápido con milisegundos

Hola

Quiero mostrar la duración más rápida con milisegundos de un conjunto de datos donde el tiempo se almacena actualmente en segundos (es decir, 65,69 segundos)

Me gustaría mostrar la hora en formato mm:ss.00.

El formato de duración es el siguiente:

Shem_R_0-1593053922870.png

He encontrado la medida para mostrar el tiempo con milisegundos como se muestra a continuación, sin embargo, necesito mostrar el tiempo más rápido por lo que estoy buscando algo como una función 'Min'.

Duration from Milliseconds = 
// Duration formatting 
// * Based on @konstatinos and  blog post 
// https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486 1/25/2016
// * Given a number of milliseconds, returns a format of "hh:mm:ss:000 format"
//
// We start with a duration in number of milliseconds
VAR Duration = SUM('Goldmine data'[Milliseconds])
// There are 3,600,000 milliseconds in an hour
VAR Hours = INT ( Duration / 3600000)
// There are 60,000 milliseconds in a minute
VAR Minutes = INT ( MOD( Duration - ( Hours * 3600000 ),3600000 ) / 60000)
// There are 1000 milliseconds in a second  
VAR Seconds = INT (MOD ( MOD( Duration - ( Hours * 3600000 ) - (Minutes * 60000),60000 ), 60000 ) / 1000)
VAR Milli = ROUNDUP(MOD(MOD ( MOD( Duration - ( Hours * 3600000 ),3600000 ), 60000 ), 1000),0)
// These intermediate variables ensure that we have leading zero's concatenated onto single digits
// Hours with leading zeros
VAR H =
    IF ( LEN ( Hours ) = 1, 
        CONCATENATE ( "0", Hours ),
        CONCATENATE ( "", Hours )
      )
// Minutes with leading zeros
VAR M =
    IF (
        LEN ( Minutes ) = 1,
        CONCATENATE ( "0", Minutes ),
        CONCATENATE ( "", Minutes )
    )
// Seconds with leading zeros
VAR S =
    IF (
        LEN ( Seconds ) = 1,
        CONCATENATE ( "0", Seconds ),
        CONCATENATE ( "", Seconds )
    )
// MilliSeconds with leading zeros
VAR MS =
    IF (
        LEN ( Milli ) = 1,
        CONCATENATE ( "00", Milli ),
        IF (
           LEN (Milli) = 2,
           CONCATENATE("0", Milli),
           CONCATENATE ( "", Milli )
        )
    )
// Now return hours, minutes and seconds with leading zeros in the proper format "hh:mm:ss"
RETURN
   CONCATENATE ( M, CONCATENATE ( ":", CONCATENATE(S, CONCATENATE(".", MS ) ) ) ) 

Cualquier ayuda sería muy apreciada.

Gracias Shem

@harshnathani , @v-shex-msft que he actualizado con datos de ejemplo en la figura.

3 REPLIES 3
Anonymous
Not applicable

¡Entiendo! Lo siento, sólo tuvo que cambiar de SUM a MIN..... 🙈 . Fácil de arreglar.

v-shex-msft
Community Support
Community Support

hola @Shem_R,

AFAIK, tipo de tiempo power bi no existía en milisegundos ni funciones relacionadas. ¿Cómo se almacenaron los datos? Si los registros se almacenan con un formato de hora común, eliminará los milisegundos al obtener datos y los convertirá en tablas de modelo de datos de power bi.

Me gustaría sugerirle que lo extraiga a una nueva columna con un formato de número entero y luego puede usar esta fórmula DAX para calcular.

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
harshnathani
Community Champion
Community Champion

Hola @Shem_R ,

Por favor, comparta datos de muestra.

saludos

Hn

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.