Forum Discussion

clk245's avatar
clk245
New Member
2 years ago

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.

 

 

8 Replies

  • 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

    • clk245's avatar
      clk245
      New Member

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

       

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

      • clk245's avatar
        clk245
        New Member

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

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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