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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
GAURAVG
Helper I
Helper I

Search for a keyword in a Comma separated list of values in a column

Hi,

I have a table called "Details" as below. (Note:Actual data table has 3000 entries)

PRODUCTREGION
AUSA,Australia,Canada
BAustralia
CIndia,China
DUSA,Canada,Australia
EIndia,USA
FUSA

 

I want to have a manual column, where if the value "Australia" or "USA" is found, it prints "Found".

So basically, it should print "Found" for A,B,D,E,F

 

I tried doing this with code :

Details[REGION] in {"USA", "Australia"}

But this somehow does not work , only if an exact match is found, it prints "Found"

It gives "Found" only for B,F

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @GAURAVG 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

d1.png

 

You may create a calculated column or a measure as below.

Calculated column:

Column = 
IF(
    CONTAINSSTRINGEXACT([REGION],"Australia")||
    CONTAINSSTRINGEXACT([REGION],"USA"),
    "Found"
)

Measure:

Measure = 
IF(
    CONTAINSSTRINGEXACT(MAX('Table'[REGION]),"Australia")||
    CONTAINSSTRINGEXACT(MAX('Table'[REGION]),"USA"),
    "Found"
)

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @GAURAVG 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

d1.png

 

You may create a calculated column or a measure as below.

Calculated column:

Column = 
IF(
    CONTAINSSTRINGEXACT([REGION],"Australia")||
    CONTAINSSTRINGEXACT([REGION],"USA"),
    "Found"
)

Measure:

Measure = 
IF(
    CONTAINSSTRINGEXACT(MAX('Table'[REGION]),"Australia")||
    CONTAINSSTRINGEXACT(MAX('Table'[REGION]),"USA"),
    "Found"
)

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot. This works perfectly

amitchandak
Super User
Super User

@GAURAVG , one why is split data into row and then you can use in; in filter https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

 

calculate(countrows(Table), filter(Table, table[Split region] in {"USA", "Australia"})

 

with current format

calculate(countrows(Table), filter(Table, search("USA",table[Split region],,0)>0 ||  search("Australia",table[Split region],,0)>0 ))

 table[Split region] in {"USA", "Australia"})

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

thanks for the hint, but:

1. I do not want the count, i need it to print some text, if it satisfies the condition,like "Found"

2. I cannot split the column manually, as in my original data, i have more than 20 comma separated values for each Region row.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.