March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
power query m converts text to numeric but loses the 0 at the beginning of the number.
For example:
0012 becomes 12
0123 becomes 123
try Number.FromText(text as text) as number
or
try Text.From( Number.FromText(text_column_number) in a new column doesn't work.
i need to keep the 0.
I haven't found a topic for this case.
Can you help me?
Solved! Go to Solution.
If you need to keep leading 0s, then you will need to retain the number as text only. Number format will not be able to show leading 0s. In Excel, you can format numbers with leading 0s but here there is no column formatting available on number columns to retain leading 0s.
Hi @Riddim ,
@Vijay_A_Verma Thank you for your replying! This indeed can't be achieved in Power Query, but it can be achieved in table view:
In Model view, choose the data column:
Then set it as below:
The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Riddim ,
@Vijay_A_Verma Thank you for your replying! This indeed can't be achieved in Power Query, but it can be achieved in table view:
In Model view, choose the data column:
Then set it as below:
The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot
If you need to keep leading 0s, then you will need to retain the number as text only. Number format will not be able to show leading 0s. In Excel, you can format numbers with leading 0s but here there is no column formatting available on number columns to retain leading 0s.
@Riddim , Try using below method
try Text.PadStart(Number.FromText([TextColumn]), Text.Length([TextColumn]), "0")
Proud to be a Super User! |
|
It didn't work. it failed to convert text to a number(it offers hasError and noHasError)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
16 | |
13 | |
12 | |
9 |
User | Count |
---|---|
36 | |
31 | |
20 | |
19 | |
17 |