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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
o59393
Post Prodigy
Post Prodigy

Add leading zeros to text in Power Query

Hi all

 

I need to replicate the following excel formula in power query:

 

o59393_1-1654484348189.png

 

Here is my power query column:

o59393_0-1654484267904.png

 

I tried:

 

o59393_2-1654484385521.png

 

 

Error came in:

 

o59393_3-1654484406489.png

 

 

 

How can i fix it?

 

Thanks.

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

 

Text.PadStart([#"[BPP CODE]"], 10, "0")

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
zat0na
New Member

The data is already in the correct format. Just change column type to text so that the leading zeros are not removed upon load.

Table.TransformColumnTypes(Source,{"BPP Code", type text})

 

CNENFRNL
Community Champion
Community Champion

 

Text.PadStart([#"[BPP CODE]"], 10, "0")

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Thanks!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.