Forum Discussion
Sergei-StPete
3 months agoFrequent Visitor
Number to text with leading zeroes and query folding
Something like Number.ToText( 2, "00") works fine and returns "02" if only we don't keep query folding with SQL server. In such case above returns "2". Text.PadStart( Number.ToText( 2, "00"), 2, "0"...
- 3 months ago
To preserve query folding, approach is to push the formatting logic to SQL compatible text operations instead using `Text.PadStart`.
#powerquery
RIGHT("00" & Number.ToText([Column]), 2)
#PowerqueryM
Text.End("00" & Number.ToText([Column]), 2)
Sergei-StPete
3 months agoFrequent Visitor
That works, thank you krishnakanth240
krishnakanth240
Super User
3 months agoGood to know. You are welcome Sergei-StPete