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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
nmoriello
Frequent Visitor

SEARCH function using another column to find value in text string

Hello,

 

I am trying to use a column name "Account Context" that is a Text string field (ex. ADJ:191907 SPORTS INC.) which contains some random integers as well as a customer name.

 

I want to be able to search the "Account Context" column and match it up with a Customer Name that is within my "Customer Name" column.

 

I have tried this a few different ways and cannot seem to get the DAX formula that can actually SEARCH the "Account Context" field and get a result.

 

any help would be great!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @nmoriello ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

Customer table:vtangjiemsft_0-1702021498288.png

Table:vtangjiemsft_1-1702021509755.png

(2)We can create a new table.

 

Table 2 = 
var tmp=CROSSJOIN('Table',Customer)
var tmp1=ADDCOLUMNS(tmp,"Flag",CONTAINSSTRINGEXACT([TranGLC_GLAcctContext],[Customer Name]))
var tmp2=FILTER(tmp1,[Flag]=TRUE())
var tmp3=SELECTCOLUMNS(tmp2,"Customer Name",[Customer Name])
return
tmp3

 

(3)Then the result is as follows.

vtangjiemsft_2-1702021564744.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @nmoriello ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1701928904315.png

(2) We can create a calculated column.

Column = IF(CONTAINSSTRINGEXACT([TranGLC_GLAcctContext],[Customer Name])=TRUE(),"Match","No Match")

(3) Then the result is as follows.

vtangjiemsft_1-1701928947451.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hi @Anonymous 

 

This Match would work fine but my issue is that every line is different. For example, below are some examples of what i am seeing in my TranGLC_GLAcctContext column, the highlighted portion are customer names that I want to extract from that field and then match up with a corresponding customer name on my "Customer" table. For example that first line would extract the "GUNARAMA WHOLESALE, INC" then match it up to my "Customer" table and spit out a column with any matching customer names.

 

Within excel I was able to do this by using this logic: 

INDEX('Customer'!$A$2:$A$2020,MATCH(TRUE,ISNUMBER(SEARCH('Customer'!$A$2:$A$2020,Table1[TranGLC_GLAcctContext]])),0))

 

I would like to basically recreate this logic with a DAX measure.

 

nmoriello_0-1701956536349.png

 

Anonymous
Not applicable

Hi @nmoriello ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

Customer table:vtangjiemsft_0-1702021498288.png

Table:vtangjiemsft_1-1702021509755.png

(2)We can create a new table.

 

Table 2 = 
var tmp=CROSSJOIN('Table',Customer)
var tmp1=ADDCOLUMNS(tmp,"Flag",CONTAINSSTRINGEXACT([TranGLC_GLAcctContext],[Customer Name]))
var tmp2=FILTER(tmp1,[Flag]=TRUE())
var tmp3=SELECTCOLUMNS(tmp2,"Customer Name",[Customer Name])
return
tmp3

 

(3)Then the result is as follows.

vtangjiemsft_2-1702021564744.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

parry2k
Super User
Super User

@nmoriello if you please read my question carefully and answer my questions, it will be helpful. Thank you! 🙂



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Sorry about that. The Data table is 602,000 rows and the Customer table is 45,000 rows of unique customers

parry2k
Super User
Super User

@nmoriello ok, what is the end goal? How big is your data table and customer table in terms of rows?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k 

 

What i am trying to end up with is being able to use a DAX function (ive tried, CONTAINSSTRING, SEARCH, FIND) to look at my "Account Context" column and be able to idenify the matching customer name that i see within my "Customer Name" column.

 

The issue i am currently having is that using any of those functions (the way I know how) isnt giving me any results. Here is one DAX forumula I have tried:

 

MATCHING COLUMN = IF( SEARCH('FINAL Sales & Cost'[Customer Name], 'FINAL Sales & Cost'[TranGLC_GLAcctContext], 1, 0) > 0, "Match", "No Match" )

 

I am getting no matches for this.

 

parry2k
Super User
Super User

@nmoriello is this a standard pattern where the customer name is always after the number? If that is the case you can extract customer name in Power Query which will simplify the solution but only if there is a set pattern.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k ,

 

No, unfortunatelyit is not a pattern, there is always an instance of the Customer Name, but the characters before it are not standarized.

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.