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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
spandy34
Responsive Resident
Responsive Resident

Formatting / Padding Numbers with Zero

I have the table below and if the UPRN has a 10 digit number I want a Zero adding to the end of the number so all the UPRN's have 11 

 

spandy34_0-1674949725768.png

@macmy034 @Bryn-MH  @tamerj1 @danextian 

 

1 REPLY 1
macmy034
Resolver I
Resolver I

https://learn.microsoft.com/en-us/powerquery-m/text-padend

 

You can use a find-and-replace or a custom column to utilise

 

Text.PadEnd([UPRN], 10, "0")

 

The below code changes it to a string and adds "0"s as doing it with Int seems to cause issues.

 

Code Example

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjE1M7ewVIrViVYyMjM1sTAxt4BwDE3NwAygGqAwUEUsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [UPRN = _t]),
    #"Changed Type1" = Table.TransformColumnTypes(Source,{{"UPRN", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type1",each [UPRN],each Text.PadEnd([UPRN],10,"0"),Replacer.ReplaceValue,{"UPRN"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"UPRN", Int64.Type}})
in
    #"Changed Type"

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.