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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Sergei-StPete
Regular 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") returns "02" but it breaks query folding.

Any way to return number-to-text with leading zeroes and keep query folding?

1 ACCEPTED SOLUTION
krishnakanth240
Resident Rockstar
Resident Rockstar

Hi @Sergei-StPete 

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)

View solution in original post

3 REPLIES 3
Sergei-StPete
Regular Visitor

That works, thank you @krishnakanth240 

Good to know. You are welcome @Sergei-StPete 

krishnakanth240
Resident Rockstar
Resident Rockstar

Hi @Sergei-StPete 

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)

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.