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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.