Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
simonxiaoss
Employee
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"

1 ACCEPTED SOLUTION
amitchandak
Super User
Super 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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super 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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.