Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
How can i convert this column to DateTIme,
I have values like 20 30 50 and when i am sum them it will be for example 140 and would like this convert to 00:02:20:00 (0 days 2 hours 20 min 0 seconds)
Input : 200
Output should be for example: 00:03:20:00
How can i achieve this on powerbi?
Solved! Go to Solution.
Generally DateTime values are expressed as decimal figures, where 1 hour is 1/24 (i.e. 0.04166666667).
Here is some sample Query code that does what I'm talking about:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjJQitWJVjKGUKZAKhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Time = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Time", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "AsTime", each [Time] / 24 / 60),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"AsTime", type duration}})
in
#"Changed Type1"
The Source row is just "Enter Data" where i've put a value in (20, 30 and 50) to give your minutes as a whole number.
Next we create a new column which converts Whole Number minutes into the DateTime I mentioned earlier (divide 24, divide 60).
Then I convert the datatype to "duration" which will show each of those times as "0.00:20:00" and so on.
Generally DateTime values are expressed as decimal figures, where 1 hour is 1/24 (i.e. 0.04166666667).
Here is some sample Query code that does what I'm talking about:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjJQitWJVjKGUKZAKhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Time = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Time", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "AsTime", each [Time] / 24 / 60),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"AsTime", type duration}})
in
#"Changed Type1"
The Source row is just "Enter Data" where i've put a value in (20, 30 and 50) to give your minutes as a whole number.
Next we create a new column which converts Whole Number minutes into the DateTime I mentioned earlier (divide 24, divide 60).
Then I convert the datatype to "duration" which will show each of those times as "0.00:20:00" and so on.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.