Forum Discussion
Removing A Single Character From A String (If It Exists)
- 8 years ago
Hi DamienJ,
Based on my test, you should be able to use the formula below to create a new column in your table in your scenario. :smileyhappy:
Column = SUBSTITUTE(Table1[Column1],"Â","")
Remark: You'll need to replace Table1[Column1] with your real table name and column name.
Regards
Try:
Column =
VAR x = FIND("Â",Table2[Transaction],,0)
return LEFT(Table2[Transaction],x-1)&RIGHT(Table2[Transaction],LEN(Table2[Transaction])-x)
Explanation:
I created a variable that will allocate the position of "Â" using FIND which will return a number. Then I used left function to get the the text before "Â". Then, I concatenated the other half, using &, with right of "Â" by subtracting the length of the transaction with the position of "Â" in the text.
Omega Thanks for the idea. I gave it a go but couldn't get the below despite some tinkering:
An argument of function LEFT has the wrong data type or has an invalid value
However, I didn't have any experience of using variables in Power BI before so this has given me ideas for other ideas to pursue, so for that thanks very much!
v-ljerr-msft Thanks for your solution :)