Forum Discussion
simonxiaoss
5 years agoMicrosoft Employee
PowerBI: Number.ToText with padding on left?
I try to convert a column of number to text, with padding '0' on the left. How do I do?
FOr example:
Number:
90
9
123
I would like to convert it to a text with 6 chars:
"000090"
"000009"
"000123"
simonxiaoss , You can do that with Power Query/M in Edit Query/Transform Data mode
https://docs.microsoft.com/en-us/powerquery-m/text-padstart
Text.PadStart([colum1], 6, "0")
In DAX
REPT("0",6-len([colum1]) ) &[colum1]
You have create a new column
1 Reply
- amitchandakSuper User
simonxiaoss , You can do that with Power Query/M in Edit Query/Transform Data mode
https://docs.microsoft.com/en-us/powerquery-m/text-padstart
Text.PadStart([colum1], 6, "0")
In DAX
REPT("0",6-len([colum1]) ) &[colum1]
You have create a new column