Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Data Cleaning: Converting from European to US/UK Number format

How do I convert from a ##.###,## number format to a ##,###.## number format?

 

There is no room to edit the data before it comes into Power Query, so needs to be changed within the query.

 

Current format is set to text as it cannot read the current character format as Decimals.

 

 

Thanks!

  • Anonymous's avatar
    Anonymous
    6 years ago

    The solution was to replace the dots with x's.

     

    Then replace the commas with dots.

     

    Then replace the x's with commas.

5 Replies

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

    Hi Anonymous 

     

    You can replace values like below.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQzN7TQszQ30TExVIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
        #"Replaced Value" = Table.ReplaceValue(#"Changed Type",".","#",Replacer.ReplaceText,{"Column1"}),
        #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",",",".",Replacer.ReplaceText,{"Column1"}),
        #"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","#",",",Replacer.ReplaceText,{"Column1"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value2",{{"Column1", type number}})
    in
        #"Changed Type1"

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Where would I slot that into the existing code? 

       

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

        Hello Anonymous ,

        somewhere in between.. meaning createing a empty line, create a new variable like Transform  =,

        past my code and connect it to the steps and after

         

        BR

         

        Jimmy

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

    Hello Anonymous ,

     

    you can apply a Table.TransformColumns like this

    Table.TransformColumns(Quelle, {{"decimals", each Number.From(_, "de-de")}})

     

    If this post helps or solves your problem, please mark it as solution.
    Kudos are nice to - thanks
    Have fun

    Jimmy

  • Anonymous's avatar
    Anonymous
    Not applicable

    The solution was to replace the dots with x's.

     

    Then replace the commas with dots.

     

    Then replace the x's with commas.