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
athan
Frequent Visitor

Transform seconds to hh:mm:ss format using measures & calculated columns

Hi all!,

 

i am new to PowerBI and struggling to show time (seconds) aggredated data on charts in hh:mm:ss format.

 

Have a table [table1] with a field table1[time] which stores time (duration actually) in seconds.

 

Have created a calculated column [time-duration] by following this well known post: http://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486 however this does not work for visualizations that perform calculations (aggregation) on [time] column.

 

Column [num-incidents] is the number of records (incidents) that have the same duration on a specific date. So to calculate the AVG of duration i have created a custom column inside the query editor:

 

[time-incidents-prod] = [time]*[num-incidents]

 

I am performing the aggregation on my report using a measure:

 

DSS-TIME-AVG-AGR = ( SUM(table1[time-incidents-prod]) / SUM(table[time]) )

 

That gives me the average of duration of incidents.

 

Then i have manage to tansform it, into hh:mm:ss format using a second measure:

 

DSS-TIME-AVG-AGR-TIMED = FORMAT(table1[DSS-TAT-AVG-AGR]/ 60 / 60 /24,"HH:MM:SS")

 

I can display it into visualizations like cards etc. but not able to use it into timeline charts to label Y axis:

 

Untitled.pnga

 

Any ideas on if this is possible?

 

As alot of people have already said, PowerBI should support a 'duration' data type that could be used to perform calculations etc and will support different format types.

 

Thanks!

 

1 REPLY 1
Greg_Deckler
Super User
Super User

Unfortunately I still do not think there is a true solution to this yet. 😞

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.