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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
rwoodward
Frequent Visitor

Counting Text from One Table to Another

Hello - I need to create a DAX that allows me to count the number of times the names in [Table 2, column Name] appear in [Table 1, column Names]. The 3rd table is how Table 2 should appear when the DAX works correctly. Would love any help.

 

Table 1

Names

John Doe

John Doe, Jane Doe

Sam Garcia, Jane Doe, John Doe

Beth Baker

 

Table 2

Name
Beth Baker
Jane Doe
John Doe
Sam Garcia
Debra Smith

 

Table 2

NameCount of Appearances in Table 1
Beth Baker1
Jane Doe2
John Doe3
Sam Garcia1
Debra Smith0
1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@rwoodward 

Add the following calculated column to Table 2:

Count of Appearances= 
VAR NameToSearch = 'Table2'[Name]
RETURN
    COUNTROWS(
        FILTER('Table1', 
            SEARCH(NameToSearch, 'Table1'[Names], 1, 0) > 0
        )
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @rwoodward 

Please try this:

countrows = 
COUNTROWS (
    FILTER (
        VALUES ( T1[Names] ),
        CONTAINSSTRING ( T1[Names], EARLIER ( T2[Name] ) )
    )
)
+ 0

danextian_0-1738975140900.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Fowmy
Super User
Super User

@rwoodward 

Add the following calculated column to Table 2:

Count of Appearances= 
VAR NameToSearch = 'Table2'[Name]
RETURN
    COUNTROWS(
        FILTER('Table1', 
            SEARCH(NameToSearch, 'Table1'[Names], 1, 0) > 0
        )
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

This worked perfectly! Thank you.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors