Forum Discussion
Alicia_Anderson
Resolver I
4 years agoHelp with Power Query custom column with multiple conditions and Text.Contains
I am trying to create a Custom Column in Power Query that looks for a text string in any of three different text fields. My main issue is that any of the fields may contain a null value and this is ...
- 4 years ago
Hi Alicia_Anderson ,
Try this instead:
try if Text.Contains([Release1], "ABC") or Text.Contains([Release2], "ABC") or Text.Contains([Release3], "ABC") then "Y" else "N" otherwise "N"This gives the following output:
Pete
BA_Pete
Super User
4 years agoHi Alicia_Anderson ,
Try this:
if Text.Contains([Release1], "ABC")
or Text.Contains([Release2], "ABC")
or Text.Contains([Release3], "ABC")
then "Y"
else "N"
Pete
Alicia_Anderson
Resolver I
4 years agoThat is what I have. Any row that has a null in one of those fields produces an Error.
- Alicia_Anderson4 years ago
Resolver I
If I change the nulls to "" beforehand, it works without a problem. Not sure what problems or concerns there may be with doing that.
- BA_Pete4 years ago
Super User
Hi Alicia_Anderson ,
Try this instead:
try if Text.Contains([Release1], "ABC") or Text.Contains([Release2], "ABC") or Text.Contains([Release3], "ABC") then "Y" else "N" otherwise "N"This gives the following output:
Pete