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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Convert seconds into hours and their format

I have a graph that presents the phrases in internal numbers, these values are in seconds and I need to convert this number in hours and present these values in the graph in the format of hh: mm: ss.

 

It is possible?

 

Follows the graph and the measurement:

 

TotalOrganizational Failures = CALCULATE (SUM (IndicatorValue [Value]); Indicator [Name] = "Organizational Failures")

 

Untitled.png

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

To convert the second to hours, you only need to divide it by 3600.

TotalOrganizational Failures = CALCULATE (SUM (IndicatorValue [Value]); Indicator [Name] = "Organizational Failures")/3600

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

You can do it easily with M script duration function

 

Please go to the below link. New custom column can be created using M script. 

 

https://www.powerbitalks.com/2019/12/convert-seconds-to-hhmmss-format.html

 

Step by Step solution has been provided.

 

Kaushlendra Mishra 

www.powerbitalks.com

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

We are able to convert seconds into hours with format "hh:mm:ss".

hh:mm:ss = 
RIGHT ( "0" & INT ( Table[seconds] / 3600 ), 2 )
    & ":"
    & RIGHT (
        "0"
            & INT ( ( Table[seconds] - INT (Table[seconds] / 3600 ) * 3600 ) / 60 ),
        2
    )
    & ":"
    & RIGHT ( "0" & MOD (Table[seconds], 3600 ), 2 )

 

But after formatting, values will be set to text data type. It is not possible to show actual values of text data in a bar chart, because it will be aggregated (Count/Count Distinct) automatically if adding it into values section in a chart visual.

 

So, your requirement cannot be achieved currently.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yulgu-msft

 

In this case I will then display the value in hours not displaying the format "hh: mm: ss", using the measure that I am already using what change should I make for it?

TotalOrganizational Failures = CALCULATE (SUM (IndicatorValue [Value]); Indicator [Name] = "Organizational Failures")

Hi @Anonymous,

 

To convert the second to hours, you only need to divide it by 3600.

TotalOrganizational Failures = CALCULATE (SUM (IndicatorValue [Value]); Indicator [Name] = "Organizational Failures")/3600

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.