Home » DAX » DAX Find Function

DAX Find Function

Find DAX in Power BI

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.

Syntax:

FIND(<find_text>, <within_text>, <start_num>, <NotFoundValue>)




Parameters:

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().

Note:

  • 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 below sample dataset into Power BI desktop-

Id Statement Rating
1 Service 5
2 Food Quality 5
3 Atmosphere 7
4 Value for money 5
5 Cleanness 7
6 Staff Frienliness 2
7 Coffe Quality 6

Now follow these steps-

Step-1: Add one new column , Right click on dataset and 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.

Find DAX function

Find DAX function

Step-3: Find DAX is case-sensitive, now pass “R” in first parameter.

Find DAX function example

Find DAX function example

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.



Leave a Reply