cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Aydeedglz
Helper IV
Helper IV

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors