Forum Discussion
SEARCH function using another column to find value in text string
- Anonymous2 years ago
Hi nmoriello ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
Customer table:
Table:
(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.
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.
Hi nmoriello ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
Customer table:
Table:
(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.
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.