Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
h_l
Post Patron
Post Patron

Identify text contains Alphabets&Number

Hello everyone,

 

Can you please help to advise, in power query, how to identify specific format of text?

Here is sample file for download.

 

After loading data, we would like to add one more column, called "Search Type".

If a Query contains either of following format text, set the value to "Product Search" in the new added Column, otherwise, set value to "non-Product Search":

 - 1 digit alphabet followed by 2-4 digits numbers, or

 - 2-3 digits numbers followed by 1-6 digits alphabets, or

 - 1-3 digits numbers followed by a "-" dash followed by 5-7 digits numbers or/and alphabets, or

 - "Nikon" or "Canon" or "Alienware" contained

h_l_1-1636410358200.png

h_l_2-1636410440532.png

 

Your inputs are appreciat3ed.

Thank you.

H

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @h_l 

 

Can you change your mind and look for "non-Product Search" with search term and "Product Search" for others?

vjaneygmsft_0-1636619850117.png

If you agree with what I said, then you can create a column.

Like this:

Column = 
 IF(SEARCH("Search Term",[Query],1,-1)>0,"non-Product Search","Product Search")

vjaneygmsft_1-1636624333129.png

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If problem still persists, pls let me know.

 

Best Regards,
Community Support Team _ Janey

 

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @h_l 

 

Can you change your mind and look for "non-Product Search" with search term and "Product Search" for others?

vjaneygmsft_0-1636619850117.png

If you agree with what I said, then you can create a column.

Like this:

Column = 
 IF(SEARCH("Search Term",[Query],1,-1)>0,"non-Product Search","Product Search")

vjaneygmsft_1-1636624333129.png

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If problem still persists, pls let me know.

 

Best Regards,
Community Support Team _ Janey

 

mahoneypat
Microsoft Employee
Microsoft Employee

This is a job for RegEx, which is not natively supported in Power BI.  However, this article describes a hack to do it.  It is also possible with R or Python.

Power Query Regular Expression Hack | Math Encounters Blog (mathscinotes.com)

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you for reply @mahoneypat , I will try to look into it although not a programmer 😉

Have a good day!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors