CONTAINSSTRING

Updated on

CONTAINSSTRING is a DAX function that returns TRUE if one text string contains another text string, and it is not case-sensitive.

Syntax

CONTAINSSTRING(
   WithinText,
   FindText
)
Argument Properties Description
WithinText The text in which you want to search for FindText.
FindText The text you want to find. You can use the ? and * wildcard characters; use ~? and ~* to find the ? and * characters.

Return Values

TRUE if find_text is a substring of within_text; otherwise FALSE.

Remarks

  • CONTAINSSTRING is not case-sensitive.

  • You can use ? and * wildcard characters. Use ~ to escape wildcard characters.

Example

DAX query

EVALUATE
    ROW(
        "Case 1", CONTAINSSTRING("abcd", "bc"), 
        "Case 2", CONTAINSSTRING("abcd", "BC"),
        "Case 3", CONTAINSSTRING("abcd", "a*d"),
        "Case 4", CONTAINSSTRING("abcd", "ef")
    )

Returns

[Case 1] [Case 2] [Case 3] [Case 4]
TRUE TRUE TRUE FALSE

Other functions related to CONTAINSSTRING are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/containsstring-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy