Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello
I'm new to PowerQuery. I have a simple question.
I want to change a column with the time in (format is text) to a time format. I used "Time.FromText"-function in PowerQuery. This is not always working. How do I have to change the text format of the time column so that it displays also the 0 in the begin.
(625 --> 0625). Is there a function for?
Greetings
Solved! Go to Solution.
@boa You can use this:
let
Source =
Table.FromRows (
Json.Document (
Binary.Decompress (
Binary.FromText (
"i45WMjQ2NlaK1QEyLEwNwQwDMyNTMMPSwABMm0IoIwMo3xCkIxYA",
BinaryEncoding.Base64
),
Compression.Deflate
)
),
let
_t = ( ( type nullable text ) meta [ Serialized.Text = true ] )
in
type table [ Time = _t ]
),
AddedCustom =
Table.AddColumn (
Source,
"Custom",
each
Time.FromText (
Text.PadStart ( [Time], 4, "0" )
),
Time.Type
)
in
AddedCustom
@boa You can use this:
let
Source =
Table.FromRows (
Json.Document (
Binary.Decompress (
Binary.FromText (
"i45WMjQ2NlaK1QEyLEwNwQwDMyNTMMPSwABMm0IoIwMo3xCkIxYA",
BinaryEncoding.Base64
),
Compression.Deflate
)
),
let
_t = ( ( type nullable text ) meta [ Serialized.Text = true ] )
in
type table [ Time = _t ]
),
AddedCustom =
Table.AddColumn (
Source,
"Custom",
each
Time.FromText (
Text.PadStart ( [Time], 4, "0" )
),
Time.Type
)
in
AddedCustom
Thank you for your help. Your syntax is too difficult for me 🤔 but I used a function from it and it works!!
I added a custom column with this function: Text.PadStart ( [Time], 4, "0" ) and then used the function Time.FromText on the added column. So thanks for your help!
@boa My syntax generates the data and fixes the issue, you don't need to use the source step, I wanted to show you how you can apply that on our data, also, I combined the code for 2 columns in just one 😎
Since my code was useful in resolving the problem, please mark it as a solution so that others can find it useful as well.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |