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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gusdahu
Helper IV
Helper IV

How to keep leading zeros when I import data from an excel file into Power BI?

Power BI Community,

 

I am importing data from an excel file into Power BI. The data contains ID numbers with leading zeros. When I import the data, the leading zeros disappear. I converted the column into text hoping this would solve the problem, but it didn't. How do I include leading zeros in my data set?

 

Regards,

Gus Dahu 

1 ACCEPTED SOLUTION

Look for a "Changed Type" step.  That would be the step to delete.

View solution in original post

5 REPLIES 5
IanT
Frequent Visitor

Just thought I'd add to this as I had the same problem but for some reason there was no 'Changed Type' step to delete, I fixed the issue by using 'Replace Values' on the problem column as below. Please note though that my desired value length was always 6 characters, so amnend as necessary.

 

I first added a dummy replace value step replacing null with null and then amended the text in bold below.
Original 

#"Replaced Value" = Table.ReplaceValue(#"Changed Type1",null,null,Replacer.ReplaceValue,{"Cost Centre"})

Amended
#"Replaced Value" = Table.ReplaceValue(#"Changed Type1",each[Problem Column],each Text.PadStart([Problem Column],6,"0"),Replacer.ReplaceValue,{"Problem Column"})

Hope it helps someone.



v-yuta-msft
Community Support
Community Support

Hi gusdahu,

 

Delete the step "Change Type" and check if "Zero" still disappear.

 

Regards,

Jimmy Tao

drewlewis15
Solution Specialist
Solution Specialist

Two things to check for:

  1. Make sure the Excel file you are using actually has the leading zero in the value of the cell... There are custom formatting options within Excel that disply the number with the leading zero without actually adding the zero the value of the cell.  Just make sure the data in your Excel sheet is being formatted as text.
  2. The Query editor usually automatically applies a formatting step after the "Source" step.  If you are changing the column to TEXT after that automatic step, then your leading zeros will not appear, as they were taken out in that automatic step. You would need to delete that automatic step and then change the column to TEXT at that point (immediately after the Source step).

Let me know if one of these two solutions resolve your issue.

Hi drewlewis15,

 

Is the step after the "Source" step you are referring to know as "Navigation"?

 

Regards,

Gus Dahu

Look for a "Changed Type" step.  That would be the step to delete.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.