Latest Enterprise DNA Initiatives

If (or) text.contains

Hi All,

I created the following formula in power query conditional column:

= Table.AddColumn(#“Removed Columns3”, “Email Filter”, each if Text.Contains([Contact Email] = “” or “” or “” or “” or “”) then “Test Emails” else [Contact Email])

but coming with an error message:

Expression.Error: We cannot convert the value “” to type Logical.

Can someone help? What am I doing wrong?


1 Like

I figured it out. I had to bracket each instance I had to add quotes around the table.

= each if Text.Contains([Domain], “”) then “Do Not Use”
else if Text.Contains([Domain],“”) then “Do Not Use”
else [Domain])


1 Like

glad you found the answer, thank you for coming back to the forum to post a solution for others :slight_smile:


Glad you find the solution but if your criteria is more than two, the following M code will be shorter:

each if List.PositionOf({“”,“”},[Domain])>=0 then “Do Not Use” else [Domain]

Instead of {“”,“”} part, you can select any list.

Also if you want to check the items which contain your list, below M code will work:

if List.Count(Splitter.SplitTextByAnyDelimiter({“”,“”})([Domain]))>1 then “Do Not Use” else [Domain]