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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Melih
New Member

Power BI Duration with days 2.14:49:15.6730000 INTO only time - But How?

Hey everyone, 

 

i need your help. I receive raw data from our system, which I load into Power BI. The duration is displayed in a column in the following format "2.14:49:15.6730000". The 2 stands for days, the 14 for hours and 49 for minutes and 15 for seconds. But I need the following format (Hours:Minutes:seconds) "62:49:15" (2 days x 24 +14 hours equals 62). i need this column not as a String. Because i have to sum  the time up.

 

I hope someone can help me. 

Thank you very much. 

 

Kind regards

Melih

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Melih ,

 

The Duration type loaded to the desktop will change to the Decimal type in days. You can still use the SUM function for aggregation:

Total Time = SUM('Table'[Time])

Use this measure when outputting results:

Format total time = 
VAR __all_seconds = [Total Time] * 24 * 60 * 60
VAR __hours = INT( DIVIDE( __all_seconds , 3600 ) )
VAR __remaining_second = MOD( __all_seconds, 3600 )
VAR __minutes = INT( DIVIDE( __remaining_second, 60 ) )
VAR __seconds = INT( __remaining_second - __minutes * 60 )
VAR __result = __hours&":"&__minutes&":"&__seconds
RETURN
__result

vcgaomsft_0-1719885335918.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

4 REPLIES 4
dufoq3
Super User
Super User

Hi @Melih, it is possible also in Power Query.

 

Result

dufoq3_0-1719914004929.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtIzNLEysbQyNNUzMzc2AAKl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    Ad_TimeFormatted = Table.AddColumn(Source, "Time Formatted", each 
        [ a = Time.FromText(Text.BetweenDelimiters([Column1], ".", "."), [Format="hh:mm:ss", Culture="en-US"]),
          b = Number.From(Text.BeforeDelimiter([Column1], ".")),
          c = Text.From(b*24 + Time.Hour(a)) & ":" & Time.ToText(a, [Format="mm:ss"])
        ][c], type text)
in
    Ad_TimeFormatted

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Anonymous
Not applicable

Hi @Melih ,

 

The Duration type loaded to the desktop will change to the Decimal type in days. You can still use the SUM function for aggregation:

Total Time = SUM('Table'[Time])

Use this measure when outputting results:

Format total time = 
VAR __all_seconds = [Total Time] * 24 * 60 * 60
VAR __hours = INT( DIVIDE( __all_seconds , 3600 ) )
VAR __remaining_second = MOD( __all_seconds, 3600 )
VAR __minutes = INT( DIVIDE( __remaining_second, 60 ) )
VAR __seconds = INT( __remaining_second - __minutes * 60 )
VAR __result = __hours&":"&__minutes&":"&__seconds
RETURN
__result

vcgaomsft_0-1719885335918.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Good Morning Gao,

 

it workss - You are amazing 😁

Thank you very much @Anonymous  !!!!🙏

 

Kind Regards,

Melih

lbendlin
Super User
Super User

Treat the duration as a number.  The integer part will be the days and the fraction part will be the rest. 

Then do your summation.  

 

Then use FORMAT to display  the string

 

result = ROUNDDOWN([value]*24,0) & FORMAT([Value]":nn:ss")

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.