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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
JNelson
Helper II
Helper II

Search column and group text

Hi all,

 

I need to create a measure or group (not a calculated column) to create a new Y/N measure based on names in a column. I've tried grouping the names but there are thousands of names in my data set and I would have to scroll forever to add new people to the group.

 

Essentially, I have a table called Teams and want to search the Name column for specified members and return Y/N

 

IsInTeam1 = IF(CONTAINSSTRING(Teams[Name] in {"Joe Bloggs", "Jane Smith", "Bob Thompson"}),"Y","N") 

I want it as a measure so it's easy enough for my colleague to add/remove a name in the formula bar when something changes. 

I am having an issue as when I use the CONTAINSSTRING function I don't get the option to add my table/column?

 

I feel like this should be a simple one but can't get my head around it!

 

TIA

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JNelson ,

 

The CONTAINSSTRING function is designed to handle individual strings, not columns or tables directly.

 

When using measure, you need to make sure that the function iterates through each row of the table to check the condition for each name.

 

If you want to learn more about the CONTAINSSTRING function, please see:

CONTAINSSTRING function (DAX) - DAX | Microsoft Learn

 

Please follow these steps:

 

1. This is the original data I created:

vhuijieymsft_0-1709176098513.png

 

2. Please try:

IsInTeam1 = 
CALCULATE(
    IF(
        COUNTROWS(
            FILTER(
                Teams,
                CONTAINSSTRING(Teams[Name], "Joe Bloggs") || 
                CONTAINSSTRING(Teams[Name], "Jane Smith") || 
                CONTAINSSTRING(Teams[Name], "Bob Thompson")
            )
        ) > 0, 
        "Y", 
        "N"
    )
)

 

3. Drag data to the report page for display:

vhuijieymsft_1-1709176098518.png

 

pbix file is attached.

 

If you have any further questions, please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @JNelson ,

 

The CONTAINSSTRING function is designed to handle individual strings, not columns or tables directly.

 

When using measure, you need to make sure that the function iterates through each row of the table to check the condition for each name.

 

If you want to learn more about the CONTAINSSTRING function, please see:

CONTAINSSTRING function (DAX) - DAX | Microsoft Learn

 

Please follow these steps:

 

1. This is the original data I created:

vhuijieymsft_0-1709176098513.png

 

2. Please try:

IsInTeam1 = 
CALCULATE(
    IF(
        COUNTROWS(
            FILTER(
                Teams,
                CONTAINSSTRING(Teams[Name], "Joe Bloggs") || 
                CONTAINSSTRING(Teams[Name], "Jane Smith") || 
                CONTAINSSTRING(Teams[Name], "Bob Thompson")
            )
        ) > 0, 
        "Y", 
        "N"
    )
)

 

3. Drag data to the report page for display:

vhuijieymsft_1-1709176098518.png

 

pbix file is attached.

 

If you have any further questions, please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Hi,

 

Instead of measure, create a column through transform data with multiple IF conditions. 

for Example :

MemberPresence = IF(

OR( CONTAINSSTRING(Teams[Name], "Member1"),

CONTAINSSTRING(Teams[Name], "Member2"),

CONTAINSSTRING(Teams[Name], "Member3") ),

"Y", "N" )

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.