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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ayoubb
Helper IV
Helper IV

DATEDIFF ENTRE DOS FECHAS con el fin de calcular el tiempo de resolución

Hola

En primer lugar, gracias por su apoyo y asistencia,

Por favor, tengo esta tabla a continuación:

DATA BASE.jpg

Y quiero calcular el tiempo medio de resolución en este formato "hh:mm:ss" pero sólo para el número de solicitud que se han creado entre 06h y 19h?

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

No @ayoubb

Cree una medida como:

Measure =

var _table=

SUMMARIZE('Table','Table'[Request number],"start",

var _start=

CALCULATE(

    MAX('Table'[creation date]),

    FILTER(

        ALL('Table'),

        'Table'[Request number]=MAX('Table'[Request number]) && 'Table'[Status]="resolved" && HOUR('Table'[creation date])>6

    )

)



var _end=

CALCULATE(

   MAX('Table'[update date]),

   FILTER(

       'Table',

       'Table'[Request number]=MAX('Table'[Request number]) && 'Table'[Status]="resolved" && HOUR('Table'[update date])<19

   )

)

return DATEDIFF(_start,_end,SECOND)

)

return SUMX(_table,[start])/COUNTROWS(_table)

Aquí está la salida:

v-xulin-mstf_0-1610445022245.png

Aquí está la demo, por favor pruébela:DATEDIFF ENTRE DOS FECHAs con el fin de calcular el tiempo de resolución

Saludos

Enlace

View solution in original post

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

No @ayoubb

Cree una medida como:

Measure =

var _table=

SUMMARIZE('Table','Table'[Request number],"start",

var _start=

CALCULATE(

    MAX('Table'[creation date]),

    FILTER(

        ALL('Table'),

        'Table'[Request number]=MAX('Table'[Request number]) && 'Table'[Status]="resolved" && HOUR('Table'[creation date])>6

    )

)



var _end=

CALCULATE(

   MAX('Table'[update date]),

   FILTER(

       'Table',

       'Table'[Request number]=MAX('Table'[Request number]) && 'Table'[Status]="resolved" && HOUR('Table'[update date])<19

   )

)

return DATEDIFF(_start,_end,SECOND)

)

return SUMX(_table,[start])/COUNTROWS(_table)

Aquí está la salida:

v-xulin-mstf_0-1610445022245.png

Aquí está la demo, por favor pruébela:DATEDIFF ENTRE DOS FECHAs con el fin de calcular el tiempo de resolución

Saludos

Enlace

Greg_Deckler
Community Champion
Community Champion

@ayoubb Si puede publicar esos datos como texto podría proporcionar una solución específica. Pero, mientras tanto aquí hay una serie de artículos sobre cálculos de duración:

(1) Duración de Chelsie Eiden - Microsoft Power BI Community

Duración a Segundos Converter - Microsoft Power BI Community

Simplemente restando sus dos entradas de tiempo como esta ([fecha de actualización] - [fecha de creación]) * 1. , obtendrá un valor decimal donde la parte entera es el número de días y la parte decimal son fracciones de un día. Así que 1/24 horas, 1/60 es minutos, 1/3600 segundos, etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

ES esto correcto:

Columna

  1. Tiempo medio de resolución: CALCULATE(DISTINCTCOUNT('table'[número de solicitud]), FILTER('table','table'[status] IN '"resuelto"'))

&& DATEDIFF('table'[fecha de creación],'table'[fecha de actualización],MINUTE)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors