FIND

How to Use the Power BI DAX function FIND

Understanding the FIND Function in Power BI

The FIND function is a DAX formula that searches for a specific text string within another text string and returns the position of the text string. The syntax of the FIND function is as follows:


FIND(find_text, within_text, [start_num])


- **find_text** is the text string that you want to find.

- **within_text** is the text string that you want to search within.

- **start_num** is an optional parameter that specifies the position within the string where the search should begin. If omitted, the search starts at the beginning of the string.

The FIND function returns the position of the first occurrence of the find_text in the within_text string. If the text string is not found, the function returns a #VALUE error.

Using the FIND Function in Power BI

To use the FIND function in Power BI, follow these steps:

1. Open a new or existing report in Power BI.

2. Create a new measure or column by clicking on the "New Measure" or "New Column" button in the "Modeling" tab.

3. Enter the FIND function syntax into the formula bar, replacing the placeholders with your own values:


=FIND(“find_text”, “within_text”, [start_num])


4. Press Enter to calculate the result.

Example

Suppose you have a table that contains a column called "Product Name" with the following values:


Product Name

————-

T-Shirt

Jeans

Sneakers

Hoodie


To use the FIND function to search for the word "T-Shirt" in the "Product Name" column, you can create a new measure with the following formula:


=IF(FIND(“T-Shirt”, [Product Name],1) ❱ 0, “Found”, “Not Found”)


This formula searches for the text string "T-Shirt" within the "Product Name" column. If the text string is found, the formula returns the value "Found". If the text string is not found, the formula returns the value "Not Found".

Common Use Cases for the FIND Function

The FIND function can be used in a variety of scenarios, including:

1. Searching for Specific Keywords

If you have a large dataset that contains text descriptions, you can use the FIND function to search for specific keywords within the text. For example, you can search for all descriptions that contain the word "sale" or "discount", which can help you identify trends or patterns in your data.

2. Extracting Substrings

The FIND function can also be used to extract substrings from a larger string. For example, you can use the FIND function to extract the first name and last name from a full name field.

3. Cleaning Text Data

The FIND function can be used to clean up data by removing unwanted characters or strings. For example, you can use the FIND function to search for and remove all instances of a specific character in a string.

The FIND function in Power BI is a powerful tool that can help you search for specific text strings within a larger string. By using the FIND function, you can improve your data analysis capabilities and gain insights into your data. Whether you are searching for specific keywords, extracting substrings, or cleaning up data, the FIND function can help you achieve your goals.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)