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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Jumper
Helper I
Helper I

Column format not pulling through correctly from Excel source

Hi.  I've got a data column in an Excel file that is formatted to 000, as it is a detail that needs to be viewed as a three digit code.

 

But when I pull the detail into Power BI, any leading zeros seem to be getting dropped off.  

Jumper_0-1708672308109.png

 

These three digit codes are alpha-numeric, so the column has imported as a general format.  Unfortuantely without the leading zero, the codes are not ordering as expected, nor are they sticking to the three digit format that is necessary.

 

 

Any suggestions how to fix?

2 REPLIES 2
v-jianpeng-msft
Community Support
Community Support

Hi, @Jumper 

When you import Excel data into Power BI, Power BI will automatically identify the data type of each column and set the corresponding type based on your data in each column. You can undo this step in Power Query, and then you can set the data type of each column according to your actual situation.

I have created the following sample data in Excel:

vjianpengmsft_0-1708917688240.png

The results of importing to Power BI are as follows:

vjianpengmsft_1-1708917771601.png

The steps to restore leading zeros are as follows:

vjianpengmsft_2-1708917823275.png

vjianpengmsft_3-1708917859206.png

vjianpengmsft_4-1708917907314.png

vjianpengmsft_5-1708917928274.png

With the above steps you can restore the leading 0's in your columns.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

jolind1996
Resolver II
Resolver II

In Power BI, you can retain leading zeros by converting the column to text format. Use the FORMAT function or concatenate an empty string to the alpha-numeric codes. For instance, use a formula like =FORMAT([Column],"000") or =[Column]&"". This ensures that the three-digit format is maintained and leading zeros aren’t dropped when importing data from Excel. This should help your codes order as expected and maintain the necessary three-digit format. Remember, Power BI treats numbers without leading zeros as numerical data, hence the need for this conversion. I hope this helps! If you have any other questions, feel free to ask.

Best regards,
Johannes

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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