Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
How can I convert a number like 1523 to time format (15:23) Using Power Query M?
Solved! Go to Solution.
Hi @tlotfi,
Here I made one sample for your reference.
Firstly, we need to split the column, then we can merge the columns we got as the picture below.
Here is the M code in power query for your reference.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ1MlGK1QExDMzADAMLI1Mww8jIyFgpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}}), #"Split Column by Position" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"Column1", type text}}, "en-US"), "Column1", Splitter.SplitTextByPositions({0, 2}, true), {"Column1.1", "Column1.2"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"Column1.1", Int64.Type}, {"Column1.2", Int64.Type}}), #"Inserted Merged Column" = Table.AddColumn(#"Changed Type1", "Merged", each Text.Combine({Text.From([Column1.1], "en-US"), Text.From([Column1.2], "en-US")}, ":"), type text), #"Changed Type2" = Table.TransformColumnTypes(#"Inserted Merged Column",{{"Merged", type time}}) in #"Changed Type2"
For more details, please check the pbix as attached.
Regards,
Frank
Hi @tlotfi,
Here I made one sample for your reference.
Firstly, we need to split the column, then we can merge the columns we got as the picture below.
Here is the M code in power query for your reference.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ1MlGK1QExDMzADAMLI1Mww8jIyFgpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}}), #"Split Column by Position" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"Column1", type text}}, "en-US"), "Column1", Splitter.SplitTextByPositions({0, 2}, true), {"Column1.1", "Column1.2"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"Column1.1", Int64.Type}, {"Column1.2", Int64.Type}}), #"Inserted Merged Column" = Table.AddColumn(#"Changed Type1", "Merged", each Text.Combine({Text.From([Column1.1], "en-US"), Text.From([Column1.2], "en-US")}, ":"), type text), #"Changed Type2" = Table.TransformColumnTypes(#"Inserted Merged Column",{{"Merged", type time}}) in #"Changed Type2"
For more details, please check the pbix as attached.
Regards,
Frank
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
63 | |
62 | |
52 | |
39 | |
24 |
User | Count |
---|---|
84 | |
57 | |
45 | |
43 | |
36 |