Forum Discussion
Anonymous
5 years agoNot applicable
replacing values based on another column using M
Hi all, I'm trying to replace some incorrect values in column A based on the values in column B. Essentially, I would like to change all of the values in Column A to "127" IF Column B = "table" witho...
- 5 years ago
Using → https://www.biinsight.com/quick-tips-conditionally-replace-values-based-on-other-values-in-power-query/ as an example
Table.ReplaceValue(#"Changed Type", each [Column A], each if [Column B] = "table" then 127 else [Column A], Replacer.ReplaceValue,{"Column A"})
ChrisMendoza
Resident Rockstar
5 years ago
= Table.AddColumn(#"Changed Type", "Custom", each if [Column B] = "table" then Replacer.ReplaceValue([Column A],[Column A],127) else [Column A])Anonymous
5 years agoNot applicable
Hey ChrisMendoza, I appreciate the help here. However I'd like to find out a solution that does not require adding a new column. Thanks!
- ChrisMendoza5 years ago
Resident Rockstar
Using → https://www.biinsight.com/quick-tips-conditionally-replace-values-based-on-other-values-in-power-query/ as an example
Table.ReplaceValue(#"Changed Type", each [Column A], each if [Column B] = "table" then 127 else [Column A], Replacer.ReplaceValue,{"Column A"})