Forum Discussion
raymondwkmok
1 year agoFrequent 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...
- 1 year ago
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?
- 1 year ago
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
1 year agoSuper 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?