Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

HELP: Adding Leading Zeros in Power Query


How do I add "0" to a column that has 5 digits, the columns should have 6 digits, but due to an error it was loaded without the leading zero.


Could you explain me the process because I am new in power query, would I have to generate a new column? or modify the one I have?

Community Support
Community Support

Hi @lottie2404 ,


I guess this column is automatically converted to an whole number type.


You can add a step to fix it by reconverting it to text type.

= Table.TransformColumns(#"Changed Type",{"Column1",each if Text.Length(Text.From(_))<6 then "0"&Text.From(_) else Text.From(_)})


Of course, if the column is of the correct type in the Source step you can unconvert it in the second step.


Best Regards,

Community Support Team


If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Super User
Super User

You can create a custom column (first make sure the column is changed to type text) using:


=Table.AddColumns(PriorStepOrTableName, {{"Padded", each Text.PadStart([NumberColumnName], "0", 1), type text}})



I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Kudoed Authors