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
rey4125
New Member

Formato hh:mm:ss

Buenos Dias.

 

Estoy haciendo unos graficos en power Bi pero no me ha sido posible representar un promedio de un dato en formato hh:mm:ss

2 ACCEPTED SOLUTIONS
Baskar
Resident Rockstar
Resident Rockstar

Cool my dear friend, Try this one

 

Age(HH:MM:SS) :=

VAR Duration = Measure in Seconds 
VAR Hours =
ROUNDDOWN ( Duration /3600 , 0 )
VAR Minutes =
ROUNDDOWN ( ( Duration - ( Hours *3600 ) )/60, 0 )
VAR Seconds =
ROUND(MOD ( Duration - ( Hours *3600 ),60 ),0)
VAR H =
IF ( LEN ( Hours ) = 1,
CONCATENATE ( "0", Hours ),
CONCATENATE ( "", Hours )
)
VAR M =
IF (
LEN ( Minutes ) = 1,
CONCATENATE ( "0", Minutes ),
CONCATENATE ( "", Minutes )
)
VAR S =
IF (
LEN ( Seconds ) = 1,
CONCATENATE ( "0", Seconds ),
CONCATENATE ( "", Seconds )
)

RETURN
CONCATENATE (
H,
CONCATENATE ( "h : ", CONCATENATE ( M, CONCATENATE ( "m : ", CONCATENATE(S,"s") ) ) )
)

View solution in original post

v-shex-msft
Community Support
Community Support

Hi @rey4125,

 

In my opinion, you can convert the time field to total second, calculated average of the total second, then format these data to time.

 

Sample:

 

Total Second= Hour(Table[Date])*3600 + Minute(Table[Date])*60+ Second(Table[Date])


AverageTime = 
var temp=INT(AVERAGE([Total Second]))
var h=INT(DIVIDE(temp,3600))
var m=INT(DIVIDE(temp-h*3600,60))
var s=temp-h*3600-m*60
return
TIME(h,m,s)

 

 

Regards,

Xiaoxin Sheng

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

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @rey4125,

 

In my opinion, you can convert the time field to total second, calculated average of the total second, then format these data to time.

 

Sample:

 

Total Second= Hour(Table[Date])*3600 + Minute(Table[Date])*60+ Second(Table[Date])


AverageTime = 
var temp=INT(AVERAGE([Total Second]))
var h=INT(DIVIDE(temp,3600))
var m=INT(DIVIDE(temp-h*3600,60))
var s=temp-h*3600-m*60
return
TIME(h,m,s)

 

 

Regards,

Xiaoxin Sheng

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

Cool my dear friend, Try this one

 

Age(HH:MM:SS) :=

VAR Duration = Measure in Seconds 
VAR Hours =
ROUNDDOWN ( Duration /3600 , 0 )
VAR Minutes =
ROUNDDOWN ( ( Duration - ( Hours *3600 ) )/60, 0 )
VAR Seconds =
ROUND(MOD ( Duration - ( Hours *3600 ),60 ),0)
VAR H =
IF ( LEN ( Hours ) = 1,
CONCATENATE ( "0", Hours ),
CONCATENATE ( "", Hours )
)
VAR M =
IF (
LEN ( Minutes ) = 1,
CONCATENATE ( "0", Minutes ),
CONCATENATE ( "", Minutes )
)
VAR S =
IF (
LEN ( Seconds ) = 1,
CONCATENATE ( "0", Seconds ),
CONCATENATE ( "", Seconds )
)

RETURN
CONCATENATE (
H,
CONCATENATE ( "h : ", CONCATENATE ( M, CONCATENATE ( "m : ", CONCATENATE(S,"s") ) ) )
)

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.