FIND DAX Function (Text)

Returns the starting position of one text string within another text string. FIND is case-sensitive and accent-sensitive.

Syntax

FIND ( <FindText>, <WithinText> [, <StartPosition>] [, <NotFoundValue>] )
Parameter Attributes Description
FindText

The text you want to find. Use double quotes (empty text) to match the first character in within_text; wildcard characters not allowed.

WithinText

The text containing the text you want to find.

StartPosition Optional

The character at which to start the search; if omitted, StartPosition = 1. The first character in WithinText is character number 1.

NotFoundValue Optional

The numeric value to be returned if the text is not found; if omitted, an error is returned.

Return values

Scalar A single integer value.

Number that shows the starting point of the text string you want to find.

Remarks

FIND does not support wildcards. To use wildcards, use SEARCH.

» 1 related article
» 1 related function

Examples

--  FIND searches the position of a substring inside a string.
--  Comparison is case-sensitive.
--  You can provide the position from where to start searching
--  and a default value to return in case of no-match.
--  If no default value is provided, FIND raises an error in case 
--  the substring is not found.
EVALUATE
CALCULATETABLE (
    ADDCOLUMNS (
        TOPN ( 5, VALUES ( 'Product'[Product Name] ) ),
        "Position of Red", FIND ( "Red", 'Product'[Product Name], 1, BLANK () )
    ),
    'Product'[Color] IN { "Red", "Blue" }
)
Product Name Position of Red
Contoso 512MB MP3 Player E51 Blue (Blank)
Contoso 2G MP3 Player E200 Red 28
Contoso 2G MP3 Player E200 Blue (Blank)
Contoso 4GB Flash MP3 Player E401 Blue (Blank)
Contoso 8GB Super-Slim MP3/Video Player M800 Red 46

Related articles

Learn more about FIND in the following articles:

  • From SQL to DAX: String Comparison

    In DAX string comparison requires you more attention than in SQL, for several reasons: DAX doesn’t offer the same set of features you have in SQL, a few text comparison functions in DAX are only case-sensitive and others only case-insensitive,… » Read more

Related functions

Other related functions are:

Last update: Apr 2, 2021   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/find-function-dax

2018-2021 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of FIND? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.