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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
clk245
New Member

How to convert Data type from Text to Number

I am trying to change this column to a data type number. The values are numbers, I've trimmed the values but whenever I try to convert to number, it still throws an error.

clk245_0-1722435266548.png

clk245_0-1722435369822.png

 

 

8 REPLIES 8
v-cgao-msft
Community Support
Community Support

Hi @clk245 ,

 

There doesn't seem to be a problem with the code provided.

If the data source is .xls file, try saving it as .xlsx and try again.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Ahmedx
Super User
Super User

create a new column and write the following formula
Number.From(
Text.Select([ON HAND QUANTITY],{"0".."9"}))

Screenshot_1.png

Tob_P
Helper V
Helper V

Do you have a sample of what's in that column at source?

clk245_0-1722439414154.png

 

I made sure that the column also was in the number format as well.

You're doing everything right. I just threw in the same data to a .pbix and it auto-detected and converted the columns to number. The only thing I can lastly suggest is removing the Trimmed Text and Replaced Value applied steps

Tob_P
Helper V
Helper V

Hard to see what might be the issue but the error message is pointing to the zero being the issue (could be everything to be honest, it's probably just flagging that as it's the first in the list).

 

I take it you've tried to convert to number without trimming first - not sure why you would need to do this. Otherwise generally this error would flag up when there's perhaps a bit of text in the column or something like a #N/A

Yep, I've tried converting without trimming, I've tried replacing values and trying to find any erronious values or text.

clk245_0-1722436636412.png

 

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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