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
MEFOX
Helper III
Helper III

Need to count number rows that have two specific values in the same column

I need to count the number off rows that have both "friend" and "foe" in the first column. I've tried to use the DAX containsstring function but I'm not having much success. Does anyone have a suggestion?

An example would be below. I would expect the count to be 2.

 

Mike is a friend and foe  
Jane is a friend   
Candy is a friend but sometime is also a foe

 

1 ACCEPTED SOLUTION
lokosrio
Helper II
Helper II

Please try with:

COUNTROWS (
    FILTER (
        table_name,
        CONTAINSSTRING ( table_name[column_name], "friend" ) &&
        CONTAINSSTRING ( table_name[column_name], "foe" )
    )
)

View solution in original post

1 REPLY 1
lokosrio
Helper II
Helper II

Please try with:

COUNTROWS (
    FILTER (
        table_name,
        CONTAINSSTRING ( table_name[column_name], "friend" ) &&
        CONTAINSSTRING ( table_name[column_name], "foe" )
    )
)

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.

Top Solution Authors