OpenBI Docs Buy

CONTAINSSTRING

Whether a text contains another, ignoring case, with SEARCH's wildcards (? and *).

Group: Text. Compatible with DAX.

Syntax

CONTAINSSTRING ( <within_text>, <find_text> )
ParameterTypeDescription
within_textTextThe text to look in.
find_textTextWhat to look for. It may hold the wildcards ? and *.

Returns

Boolean. TRUE when the text holds what is looked for, FALSE when not.

Remarks

  • Upper and lower case are the same to it.
  • ? stands for any one character and * for any run of characters. Put ~ before ?, * or ~ to look for that character itself.
  • Looking for an empty text gives TRUE in any text that has a character. In an empty or blank text nothing is found, so the result is FALSE.
  • A number is turned into text first: CONTAINSSTRING ( 12345, 23 ) is TRUE.
  • To know where the text is, use SEARCH; for case to count, CONTAINSSTRINGEXACT.

Examples

Companies that are plants

PLANT in capitals still finds plant.

EVALUATE
FILTER ( Companies, CONTAINSSTRING ( Companies[Company], "PLANT" ) )
ORDER BY Companies[Key]
Companies[Key]Companies[Parent]Companies[Company]
1110Bergen plant
1210Oslo plant
1310Trondheim plant

Wildcards

EVALUATE
ROW (
    "b*plant", CONTAINSSTRING ( "Bergen plant", "b*plant" ),
    "b?rgen", CONTAINSSTRING ( "Bergen plant", "b?rgen" ),
    "A star", CONTAINSSTRING ( "5*3", "~*" ),
    "oslo", CONTAINSSTRING ( "Bergen plant", "oslo" )
)
b*plantb?rgenA staroslo
TRUETRUETRUEFALSE

CONTAINSSTRINGEXACT, SEARCH, FIND, FILTER.

Last updated · OpenBI Studio 0.3.74