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"})
ImkeF
4 years agoCommunity Champion
Hi lf963 ,
your null does look like simple text and not the "real" null. So this would probably work:
Table.ReplaceValue(#"Changed Type", each [LIKE], each if [Color] = "Red" and [Like] = "null" then "N" else [Like],Replacer.ReplaceText,{"Like"})
lf963
4 years agoFrequent Visitor
Hello ImkeF,
The screenshot shown in my original post was manually created. I should've made them real "null". The following screenshot is the correct one:
The following syntax doesn't work:
= Table.ReplaceValue(#"Replaced Value", each [Like], each if [Color] = "Red" and [Like] = null then "N" else [Like],Replacer.ReplaceText,{"Like"})