Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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
Solved! Go to Solution.
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
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
Hi @Melih, it is possible also in Power Query.
Result
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
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
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
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")
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
12 | |
11 | |
9 | |
6 | |
6 |