Please note javascript is required for full website functionality.


Power Pivot Principles: The A to Z of DAX Functions – CONTAINSSTRING

12 July 2022


In our long-established Power Pivot Principles articles, we continue our series on the A to Z of Data Analysis eXpression (DAX) functions.  This week, we look at CONTAINSSTRING.



This function returns the value TRUE or FALSE, depending upon whether one text string is contained within another.

The CONTAINSSTRING function employs the following syntax to operate:

CONTAINSSTRING(within text, find text)

  • within text: this is required.  This represents the text in which you wish to search for find text
  • find text: also required, this represents the text sought.

If find text is indeed a substring of within text then TRUE is returned; otherwise, FALSE results.

It should be further noted that:

  • CONTAINSSTRING is not case sensitive
  • you may use ? (single character) and * (one or more characters) as wildcard characters (use ~to escape the wildcard characters).

The following DAX query

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

will provide the following results:

Case 1 Case 2 Case 3 Case 4

Come back next week for our next post on Power Pivot in the Blog section. In the meantime, please remember we have training in Power Pivot which you can find out more about here. If you wish to catch up on past articles in the meantime, you can find all of our Past Power Pivot blogs here.