Search code examples
powerbipowerquerydata-cleaningm

How do I remove quotation marks from characters strings in Power BI?


I have unstructured data with quotation marks I'd like to remove using Power Query. Here's an example:

Have: chrome has been “processing” for 8 mins now.

Want: chrome has been processing for 8 mins now.

I've tried right clicking the column, choosing Replace Values, and in the 'Value to Find' block typing " And in the 'Replace With' block I leave it blank.

This generates code like this:

= Table.ReplaceValue(#"PreviousAppliedStep","""","",Replacer.ReplaceText,{"Text String"})

However, when I apply it, the quotation marks are not removed from the string.

I have also tried several other variations:

= Table.ReplaceValue(#"PreviousAppliedStep",""","",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep","","",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep","'"'","",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep",'"',"",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep","'""'","",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep",'""',"",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep",#(0022),"",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep","#(0022)","",Replacer.ReplaceText,{"Text String"})
= Table.ReplaceValue(#"PreviousAppliedStep",U+0022,"",Replacer.ReplaceText,{"Text String"})

These options all either generate errors or else execute but without removing the quotation marks.

I know the challenge is that Power Query reads the " quotation mark as a separator to indicate where a text string starts and stops, but I don't know how to tell it that is the actual character I want removed.


Solution

  • It depends on the type of your quotation mark. Are they "" or “” as these are different chars. Easiest way is to copy them from the preview window and place that in the replace dialogue.

    enter image description here