Forum Discussion
lf963
4 years agoFrequent Visitor
Replace null with if statement
Hello, I have a table shown in the following screenshot: What I want to do is: if column Color is Red AND column Like is null, replace the null in the Like column with "N". Therefore, ...
- 4 years ago
OK, now the nulls are real nulls (as they are in italics now).
So you have to go back to without quotes and use a different replacer function (ReplaceValue instead of ReplaceText) like so:Table.ReplaceValue(#"Replaced Value", each [Like], each if [Color] = "Red" and [Like] = null then "N" else [Like],Replacer.ReplaceValue,{"Like"})
Rickmaurinus
4 years agoHelper V
Hi lf963 ,
You can try the following code and use the Replacer.ReplaceValue function. Hope that helps!
= Table.ReplaceValue(#"Replaced Value1", each [Like], each if [Color] = "Red" and [Like] = null then "Y" else null, Replacer.ReplaceValue,{"Like"})
--------------------------------------------------
@ me in replies or I'll lose your thread
Master Power Query M? -> https://powerquery.how
Read in-depth articles? -> BI Gorilla
Youtube Channel: BI Gorilla
If this post helps, then please consider accepting it as the solution to help other members find it more quickly.