cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aydeedglz
Helper II
Helper II

Convert Special Characters Coma (,) to Point (.) only to errors

I am traying to correct the error where I have ( ,) and (. ) in my colum FC gross amount column. I want to repleace the 

(,) to (.) and disppear the (,) because I need to convert from text to number the column in order to do measures and make my query connect.

 

I want to combine two types of data the "correct" (-6,570.54) and those that are making my error "incorrect" (-74.505,74)

snnpnnncnn and sncnnn.nn   in the same file for example

-74.505,74
-6,570.54

 

I have tried:

  • replace values . with nothing
  • replace values , with .
  • change type to fixed decimal number

And it works for this case -74.505,74

 

BUT -6,570.54 changes to -657054 it erase the decimal 

 

Case 1 (Errors -74.505,74)

Aydeedglz_0-1668537954128.png

Aydeedglz_1-1668537992718.png

 

 

Case 2 (Correct number -6,570.54) When using solution to error 

 

Aydeedglz_3-1668538050267.png

Aydeedglz_2-1668538033563.png

 

 

 

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

Hi @Aydeedglz ,

You can consider pressing '.' Split the columns so that you get two columns, one for the integer part and one for the decimal part, replacing the ',' in the decimal part and finally combining them into one column.

vcgaomsft_0-1668580706330.png

vcgaomsft_1-1668580735993.png

vcgaomsft_2-1668580924241.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jXTMTU30DM1UYrVAfLMTfRMDUx1zIHcWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Replaced Value" = Table.ReplaceValue(#"Split Column by Delimiter",",","",Replacer.ReplaceText,{"Column1.2"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value", "Custom", each [Column1.1] & "." & [Column1.2]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1.1", "Column1.2"})
in
    #"Removed Columns"

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

View solution in original post

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @Aydeedglz ,

You can consider pressing '.' Split the columns so that you get two columns, one for the integer part and one for the decimal part, replacing the ',' in the decimal part and finally combining them into one column.

vcgaomsft_0-1668580706330.png

vcgaomsft_1-1668580735993.png

vcgaomsft_2-1668580924241.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jXTMTU30DM1UYrVAfLMTfRMDUx1zIHcWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Replaced Value" = Table.ReplaceValue(#"Split Column by Delimiter",",","",Replacer.ReplaceText,{"Column1.2"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value", "Custom", each [Column1.1] & "." & [Column1.2]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1.1", "Column1.2"})
in
    #"Removed Columns"

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

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.