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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
xieyifan2008
Frequent Visitor

Strange Data Type Conversion from Number to Text

Hi,

I have a table in Excel file and all the cells are General data type.

000086.jpg

When I import to Power BI through query and change data type to Text, the result is strange.

000087.jpg

Can someone help me understand if this issue is a bug or I did something wrong?

000088.jpg

 Thanks.

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @xieyifan2008 ,

 

I got response from PG:

"This is by design. Numbers in Excel use floating point, so certain values can't be represented with full precision.

We apply the same display rounding that Excel uses when rendering the preview tables that contain numbers. But if you click on a cell you can see the full (non-rounded) value.

If you convert the column to Text (as this customer did), you get the full non-rounded value."

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

8 REPLIES 8
v-frfei-msft
Community Support
Community Support

Hi @xieyifan2008 ,

 

I got response from PG:

"This is by design. Numbers in Excel use floating point, so certain values can't be represented with full precision.

We apply the same display rounding that Excel uses when rendering the preview tables that contain numbers. But if you click on a cell you can see the full (non-rounded) value.

If you convert the column to Text (as this customer did), you get the full non-rounded value."

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Thanks for your feedback.

It's bacause of the precision of binary. I understand now.

Anonymous
Not applicable

Hi xieyifan2008,

 

I think it is because Power Bi is automatically detecting the data type of the column. Can you try disabling the below highligted options and see if it helps..

 
 

Capture1.PNG

Let me know if this works..

 

Thanks,

Sneha

Thanks for your suggestion.

Unchecked two automatic options. In Power Query, there is just no automatic type change. When I insert the type change from any to text, it keeps the same result.

000093.jpg

Stachu
Community Champion
Community Champion

in Excel, if you go to cell A2, the value in the formula is 4.1, or similarly to what you see in PowerQuery 4.099999...? If you have formula there (e.g. result of division), then copy the cell and paste as values to see what is the result exactly.

I assume you will see 4.099999... in the formula bar, even though it will display in the Sheet as 4.1

 

Cell "type" in Excel is actually just a format, and does not affect what is stored in the cell, only the way it's displayed (e.g. Date type is actually stored as Integer, etc.)

So in my opinion PowerQuery is showing you the actual value, while Excel shows a formatted value with 1 decimal (in the sheet, you should see the actual value without format in the formula bar). 

 

Now you can either

  • format the column in DAX so that the value will stay the same but will look like 4.1
  • round the values (it may produce different aggregate values like SUM)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thanks for reply.

All the numbers are input manually. No formula involved.

000089.jpg

Same issue happened while using Power Query in Excel environment.000090.jpg

Microsoft Excel for Office 365 (16.0.11929.20586) 64bit

Power BI (2.78.5740.721) 64bit

Hi @xieyifan2008 ,

 

Thanks for pointing it out, I can reproduce it by using the same version of Power bi desktop as yours. I have reproted it to PG. Once fixed, will let you know 🙂

2.png

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Thanks for your help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors