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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
raymondwkmok
Frequent Visitor

How to use Text.Format for setting a single digit number to doble digit format

Hi there,

I'd like to set the numbers in a cloumn to fixed 2-digit format and used the following formula in Power Query but got an error.

#"Set 2 Digit" = Table.TransformColumns(#"Changed Type4",{"Leak Sensor", each Text.Format(_, "00")}),

Please may I have your comment and advice for solving this problem.

Thanks
Raymond 

2 ACCEPTED SOLUTIONS
OwenAuger
Super User
Super User

Hi @raymondwkmok 

Number.ToText is the appropriate function if you want to convert a number to a 2-digit text representation.

 

I would suggest changing the code for this step to:

#"Set 2 Digit" = Table.TransformColumns(#"Changed Type4",{"Leak Sensor", each Number.ToText(_, "00"), type text})

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

shafiz_p
Super User
Super User

Hi @raymondwkmok  You could also try Text.PadStart , Text.From. Try this:

=Table.TransformColumns(#"Changed Type", {{"Leak Sensor", each Text.PadStart(Text.From(_), 2, "0"), type text}})

 

Hope this helps!!

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @raymondwkmok,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept  as  Solution" and give a 'Kudos' so other members can easily find it.

Thank you,
Pavan.

 

Anonymous
Not applicable

Hi @tongnghi,

I wanted to follow up since we haven't heard back from you regarding our last response. We hope your issue has been resolved.
If the community member's answer your query, please mark it as "Accept as Solution" and select "Yes" if it was helpful.
If you need any further assistance, feel free to reach out.

Please continue using Microsoft community forum.

Thank you,
Pavan.

Anonymous
Not applicable

Hi @raymondwkmok,

Thank you for reaching out in Microsoft Community Forum.

Thank you @shafiz_p ,  @OwenAuger  for the helpful response

As suggested OwenAuger, Shafiz_p,  I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as solution" and give it a 'Kudos' so others can find it easily.

Please continue using Microsoft community forum.

Regards,
Pavan.

shafiz_p
Super User
Super User

Hi @raymondwkmok  You could also try Text.PadStart , Text.From. Try this:

=Table.TransformColumns(#"Changed Type", {{"Leak Sensor", each Text.PadStart(Text.From(_), 2, "0"), type text}})

 

Hope this helps!!

OwenAuger
Super User
Super User

Hi @raymondwkmok 

Number.ToText is the appropriate function if you want to convert a number to a 2-digit text representation.

 

I would suggest changing the code for this step to:

#"Set 2 Digit" = Table.TransformColumns(#"Changed Type4",{"Leak Sensor", each Number.ToText(_, "00"), type text})

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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