Need help with Replace tool and IF condition

Hello-

I’m working in Power Bi queries… I have a simple task to perform:

Column A [account] with account numbers

Column B [Replace Last xxx| with “Notes for Replacements”

I have to replace last 3 digits of account numbers , which are labeled accordingly.

I created a new column where I’m trying to replace each row with last xxx “-018” to “-002” in Column A:

if [Column B]=" to 002" then replace ( [Column A], 10,11,12,13, “-002”) else [Column A]

|123-456-018| to 002|

|123-326-018|no|

|123-456-018|to 002|.

I’m getting PB message: “Expression. Error: The name ‘Replace’ wasn’t recognized. Make sure it’s spelled correctly.”

I have a filling that I’m talking a wrong approach with a new column.

Please help! Thank you very much!

Natasha

Hi @npower

I think you need to add Text.Replace() function to do so, if still getting error then please help to share sample file to help you better.

Thanks

Thank you very much! Couldn’t find the proper formular:) but found another solution.

It would be nice to show your solution so other can learn :slight_smile: ty

:slight_smile: I just created extra columns with simple “if else then 0.00” and combined them together.
I’m pretty sure, It’s not the best practice :slight_smile:

1 Like

ty…i’m sure there are other ways but as long as it is solved for you. its all good :slight_smile: