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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
melimob1
Helper I
Helper I

DAX Measure or Calculated Column for identifying match between two tables (one column exact match, o

Hi 

Need help with...

DAX Measure or Calculated Column for identifying match between two tables (one column exact match, other partial substring/Keyword match)

 

I have this scenario:

Table 1 (source table)

CustomerCountryString
aUKApples, oranges
bUSAPear, Orange
cUKApple
dUKPear, Orange

 

Table 2 (match/lookup table)

CountryKeyword
UKApple
USAOrange

 

I want to lookup Table 1 Country against Table 2 Country, then search for table2'keyword' against table1'string' column to return where it is found/not found.

E.g. 

Result would be to highlight 

All customers who do not match Keyword and which countries they're in 

E.g.

Result

CountryKeywordCount of customer MATCHCount of customer MIS MATCHCount of customer that have multi values 
UKApple2 (i.e. (a,c) 1 (d) 2 (a,d)
USAOrange1 0 1

 

Would need it so I can get the list of those customers in drill down also.

 

Usually in PQ, I would split string to a list, concat and then compare but I'm sure there is an easier way to do this?

Data is one thing but any suggestions on a nice visual to demonstrate this would also be appreciated.

 

thank you in advance! 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

you can try this

 

Column = calculate(COUNTROWS('Table'),FILTER('Table',CONTAINSSTRING('Table'[String],'Table (2)'[Keyword])&&'Table'[Country]='Table (2)'[Country]))
Column 2 = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Country]='Table (2)'[Country]))-'Table (2)'[Column]
Column 3 = CALCULATE(COUNTROWS('Table'),FILTER('Table',CONTAINSSTRING('Table'[String],",")&&'Table'[Country]='Table (2)'[Country]))
 
11.PNG
pls see the attachment below
 
 
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

you can try this

 

Column = calculate(COUNTROWS('Table'),FILTER('Table',CONTAINSSTRING('Table'[String],'Table (2)'[Keyword])&&'Table'[Country]='Table (2)'[Country]))
Column 2 = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Country]='Table (2)'[Country]))-'Table (2)'[Column]
Column 3 = CALCULATE(COUNTROWS('Table'),FILTER('Table',CONTAINSSTRING('Table'[String],",")&&'Table'[Country]='Table (2)'[Country]))
 
11.PNG
pls see the attachment below
 
 
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




thank you so much Ryan

I managed to apply and the result worked.  I then also merged the 'keyword' column into my source table and did an if statement so I could tag each row and use it not only as counts but in a visual sliced different ways.  Really appreciate you taking the time.

thank you!

 

you are welcome, pls accept the answer as the solution. Thanks





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ExcelMonke
Super User
Super User

Hello,
You can consider the following DAX:

MatchFlag = 
IF(Table1[Keyword] IN VALUES (Table2[Keyword]),1,0)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





thank you but would this also consider matching on the country then finding the relevant keyword?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Kudoed Authors