Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a column that contains the time as HHMMSS like 120530 for 12:05:30 or 30503 for 03:05:03.
How is it possible to change this to a data type of time?
Solved! Go to Solution.
Input
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
cType = Table.TransformColumnTypes(Source,{{"time", Int64.Type}}),
convert = Table.TransformColumns(cType,{{"time", (x)=> let t = Text.From(x) in List.Accumulate({4,2}, if Text.Length(t) = 5 then "0" & t else t , (s,c)=> Text.Insert(s,c,":"))}}),
out = Table.TransformColumnTypes(convert,{{"time", type time}})
in
out
Output
Input
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
cType = Table.TransformColumnTypes(Source,{{"time", Int64.Type}}),
convert = Table.TransformColumns(cType,{{"time", (x)=> let t = Text.From(x) in List.Accumulate({4,2}, if Text.Length(t) = 5 then "0" & t else t , (s,c)=> Text.Insert(s,c,":"))}}),
out = Table.TransformColumnTypes(convert,{{"time", type time}})
in
out
Output
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |