Forum Discussion
Replacing values based on another column
Hi All,
Happy Friday! So I'm trying to figure out how to replaced values based on another column and have something like this:
= Table.ReplaceValue(#"Removed Columns1", each [A], each if [B] = "inactive" then "B is inactive" else [A], Replacer.ReplaceText, {"A"})
Works great except with one exception. It does not replace null values of col A!
Yeah, I get I can back out and do this by adding a new conditional column or by replacing null with "ugh" and replacing it back to null after I'm done. But this is more about getting better at Power Query M and understanding the forumla. Plus it's Friday and I want to end the week on a win instead of a compromise.
So it feels like there is something very minor we're missing to get it all done in that one line, but haven't had any luck so far. Let me know if you all have any ideas.
Thanks in advance!
- Anonymous6 years ago
Hi PANDAmonium
I think it is something very minor - try Replacer.ReplaceValue instead of Replacer.ReplaceText and let us know.
I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
2 Replies
- AnonymousNot applicable
Hi PANDAmonium
I think it is something very minor - try Replacer.ReplaceValue instead of Replacer.ReplaceText and let us know.
I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.- PANDAmoniumResolver IV
That fixed it! I probably autofilled it and didn't notice the difference; then focused only on thinking it was an issue with the second parameter. But yeah, I'll remember that for next time and it should be really helpful here on.
Thanks Anonymous !