cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

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

Accepted Solutions
Highlighted
Super User IX
Super User IX

Re: PowerBI: Number.ToText with padding on left?

@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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

1 REPLY 1
Highlighted
Super User IX
Super User IX

Re: PowerBI: Number.ToText with padding on left?

@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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors