Forum Discussion
maalsan
4 years agoAdvocate I
Find multiple substring DAX CONTAINSSTRING
Hello everyone, I need to find if the substrings "house", "home", "dewelling" appear in a long string column. Using CONTAINSSTRING I am able to find each word at a time- house= CONTAINSSTRING(tab...
- 4 years ago
That's weird. It still gives me an error message.
I found the solution to be simply:
house= CONTAINSSTRING(table1[column1], "house" ) || CONTAINSSTRING(table1[column1], "home" ) || CONTAINSSTRING(table1[column1], "dewelling" )
Without the need of IF statements.
Thanks!
diegovelez
1 year agoFrequent Visitor
For anyone on this forum, Copilot gave me this solution which works quite well:
ContainsAnyValue =
VAR StringList = {"Value1", "Value2", "Value3"} -- Step 1: Define the list of string values
RETURN
IF (
COUNTROWS (
FILTER (
StringList,
CONTAINSSTRING ( [YourColumnName], [Value] )
)
) > 0,
TRUE(),
FALSE()
)