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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
bhushan_7
New Member

All characters after 15 characters getting converted into zeros after changing data type to text

Hi,

 

I have numbers in excel (data source). Numbers are of various lengths. In all numbers where characters are more than 15, automatically zeroes appear, replacing any characters present in the original number.

 

bhushan_7_0-1677307863260.png

 

I need this in text as I want to append this with another text. Adding an @ mention as I saw a solution in another post but that is to a different issue.

@AllisonKennedy 

2 REPLIES 2
ronrsnfld
Super User
Super User

The values in Excel are text strings.

PQ will automatically detect those text strings as numbers, and reduce them to a maximum of 15 digits precision.

If you want to maintain them as the original values that you see in Excel, you need to prevent that conversion from happening in PQ.

 

In PQ, open the Advanced Editor (on the Home tab)

you will see a line near the top of the code that starts with:

  #"Changed Type" = Table.TransformColumnTypes(Source, {{"ColumnName", type number},{"Another ColumnName", Int64.Type},.....

 

For the entry where "ColumnName" is the name of the column where your data exists, merely change type number or Int64.Type to type text.  And, unlike Excel, the case (capitalization) IS important.

serpiva64
Solution Sage
Solution Sage

Hi,

this is what you get by adding a custom column

= Table.AddColumn(Source, "Custom.1", each if Text.Length([Column1]) <= 15 then [Column1] else Text.Start([Column1],15)& Text.Repeat("0",Text.Length([Column1])-15))

serpiva64_0-1677315807858.png

If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors