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.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |