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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Larry_USPS
New Member

Trying to look up from another table based on array

I have a collumn with paragraphs (words) in one table and in a 2nd table I have a list of words in a collumn.  I am trying to find a formula whereby DAX will look at all the words in the "paragraph" collumn and see if any of the words match the list of words in the other table.  Is this possable ?

 

Example:

Table 1[solution]: This solution will be found on page 246 of the manual

Table 2[words]:

Solution

fact

licence

 

The formula would return either a "Yes" or a count of 1 because it maych the word "Solution"

 

 

 

1 ACCEPTED SOLUTION

hi @Larry_USPS ,

 

try with SEARCH instead like:

match2 = 
IF(
    COUNTROWS(
        FILTER(
            table2,
            SEARCH(table2[words], Table1[paragraphs], 1, 0)>0
        )
    )>0,
"Yes", "No"
)

 

SEARCH shall work in Power Pivot and i verified the code in Power BI:

FreemanZ_0-1730867804633.png

View solution in original post

9 REPLIES 9
FreemanZ
Super User
Super User

hi @Larry_USPS ,

 

try to write a calculated column in table1 like:

match =

IF(

COUNTROWS(

    FILTER(

         table2,

         CONTAINSSTRING(table1[paragraphs], table2[words])

)>0,

"Yes", "No"

)

Thanks Again, got an arror with the command "containsstring".  Tried Contains(Strings) that didnt work either.  THoughts?  thanks again

 

hi @Larry_USPS ,

 

indeed there are some typo, please try this:

match = 
IF(
    COUNTROWS(
        FILTER(
            table2,
            CONTAINSSTRING(Table1[paragraphs], table2[words])
        )
    )>0,
"Yes", "No"
)

 

it worked like:

FreemanZ_0-1730786401694.png

 

Thanks for hanging with me and helping.. I think I found my issue, I am doing this in PowerPivot, not PowerBI, this the ContainsString isnt recoginized. Is there a way to do this within PowerPivot DAX commands ?

 

Thanks again

Larry

hi @Larry_USPS ,

 

try with SEARCH instead like:

match2 = 
IF(
    COUNTROWS(
        FILTER(
            table2,
            SEARCH(table2[words], Table1[paragraphs], 1, 0)>0
        )
    )>0,
"Yes", "No"
)

 

SEARCH shall work in Power Pivot and i verified the code in Power BI:

FreemanZ_0-1730867804633.png

That Worked ! ... THANK YOU !! 🙏

vojtechsima
Super User
Super User

Hello, @Larry_USPS ,

sure thing,

given we have 1 table for paragraphs,  second for words:

vojtechsima_1-1730751182181.png

 

times_found = 
var currentWord = SELECTEDVALUE(words[words])
var containsWord = COUNTX(par, IF(CONTAINSSTRING(par[p], currentWord), 1))

return containsWord
is_found = 
var currentWord = SELECTEDVALUE(words[words])
var containsWord = COUNTX(par, IF(CONTAINSSTRING(par[p], currentWord), 1))
var is_found = containsWord >= 1

return is_found

Thank you... can I invert this, so the match is on the table with the paragraphs?  The use case is trying to confirm people are using the assigned list of words in their submissions.  thanks again

Yeah, @Larry_USPS ,

no problem:

vojtechsima_0-1730754284791.png

is_found = 
var currentParagraph = SELECTEDVALUE(par[p])
var containsWord = COUNTX(words, IF(CONTAINSSTRING(currentParagraph, words[words] ), 1))
var is_found = containsWord >= 1

return is_found
times_found = 
var currentParagraph = SELECTEDVALUE(par[p])
var containsWord = COUNTX(words, IF(CONTAINSSTRING(currentParagraph, words[words] ), 1))

return containsWord

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.