Forum Discussion

purnima13's avatar
purnima13
Icon for Helper I rankHelper I
9 years ago
Solved

Can't convert text to decimal

I have put the following values in a google doc:
The column is formatted into number in the google doc

 

latitude
7.4064
7.6904
7.6904
5.3627
7.6904

 

I am however unable to transform it into a decimal number in power BI.
It says- Error: We couldn't convert to Number.

Please help me fix this.

  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi purnima13,

     

    Could you try to replace the "." for a "," and see if that helps ?

     

    regards,

    L.Meijdam

11 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi purnima13,

     

    Could you try to replace the "." for a "," and see if that helps ?

     

    regards,

    L.Meijdam

    • mihalytoth's avatar
      mihalytoth
      New Member

      Hi Anonymous

      It worked for me, thanks a lot!

      Best regards,

      Mihaly

    • purnima13's avatar
      purnima13
      Icon for Helper I rankHelper I

      Anonymous: I can't believe this actually worked. Thank you so much.
      But I still don't understand why, do you know?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi purnima13,

         

        I have not a single idea why a "," works and a "." does'nt, but it happened to me before and this solved it for me. That is how I knew.

         

        Anyway glad it worked for you :)

         

        Regards,

        L.Meijdam

  • Sujith_S's avatar
    Sujith_S
    Frequent Visitor

    Hi,
    The process is very simple.. Go to the Query Editor and right click on the column and change the Type to the desired type.

    We cannot convert the type from a whole number to decimal from a data view. enable the query editor and change it.

    All the best!

  • vanessafvg's avatar
    vanessafvg
    Icon for Community Champion rankCommunity Champion

    purnima13 the problem is going to be some other text field possibly in your column are you sure its all decimals?  i dont see why there would be a problem converting,  otherwise there might be spaces trying doing a format  clean and trim in power query

    • purnima13's avatar
      purnima13
      Icon for Helper I rankHelper I

      vanessafvg: The only values in the file is what you see.
      I have tried cleaning and trimming and it did not work

  • This has been solved a long time ago, but in case someone stumbles on this post looking for a solution, an alternative solution that I would prefer in such a case is making use of the optional Culture field of the TansformColumnTypes function. By adding "en-US" after de list of fields to modify, the "." will be parsed as the decimal separator. Example:

    =Table.TransformColumnTypes(#"PreviousStep", {"MyTextColumn", type number}, "en-US")

  • Left-click on the heading of the column you want to convert from text to decimal. Click on the icon indicating the data type. Then instead of clicking on "1.2 Decimal value" click on the last item "Using Locale..."  From the Data Type drop-down list select "Decimal Number". From the Locale drop-down list select  "English (United States)". Only this locle works, the outers does not.