Forum Discussion
Jorr13
4 years agoFrequent Visitor
How would I replace individual zeros in Power Query Editor but not if a number included a zero
How would I replace individual zeros with blanks but leave zeros if it was contained within say a phone number? Want to replace 0 with nothing/blank but when I use the repalce values function in ...
- 4 years ago
Try this Power Query step:
ReplaceText = Table.ReplaceValue( Source, each if [Column1] = "0" then null else "0", each if [Column1] = "0" then [Column1] else "", Replacer.ReplaceText, {"Column1"} )
DataInsights
4 years agoSuper User
In Power Query, create a custom column using this if statement. This assumes [Column1] is a text data type.
if [Column1] <> "0" then Text.Replace([Column1], "0", "") else [Column1]
- Jorr134 years agoFrequent Visitor
Thanks DataInsights Do you know if there is a way to do the replacement without creating a new column?
- DataInsights4 years agoSuper User
Try this Power Query step:
ReplaceText = Table.ReplaceValue( Source, each if [Column1] = "0" then null else "0", each if [Column1] = "0" then [Column1] else "", Replacer.ReplaceText, {"Column1"} )