Find DAX function is used to returns the starting position of one text string within another text string. FIND is case-sensitive and its comes under TEXT functions DAX category.
FIND(<find_text>, <within_text>, <start_num>, <NotFoundValue>)
find_text: The text you want to find, use double quote.
within_text: The text containing the text you want to find.
start_num: (optional) The character at which to start the search; if omitted, start_num = 1. The first character in within_text is character number 1.
NotFoundValue: (optional) The value that should be returned when the operation does not find a matching substring, typically 0, -1, or BLANK().
- This function does not support Direct Query mode
- FIND DAX does not support wildcards. For wildcards character use SEARCH DAX.
Let’s get started:
Import the following sample dataset into Power BI Desktop:
|4||Value for money||5|
Follow these steps:
Step-1: Add a new column by right-clicking on the dataset. Then, select “New Column” and write below DAX function.
Find char position = FIND("r",Survey[Statement], , -1)
Step-2: Here we want to find “r” character position for all values of Statement column. Now click on Data tab and you can see the position number. It will return -1, if not found character in string.
Step-3: Find DAX is case-sensitive, now pass “R” in first parameter.
You can see in above screen shot, capital “R” is not exist in string that’s why DAX returns -1 for all.
Refer other DAX post – DAX Tutorials
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.