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
Anonymous
Not applicable

String Searching - A replacement for CountIF

Hi all

This is likely simple and i'm over doing it - But please help.

 

I have a dataset, there's 1 row per application. 

There is a text string column for 'Region' which is annoyingly grouped whatever region the end user has selected, deliminated by a comma.

 

I need to be able to present the data by region with a sum of applications and costs. 

I have used search to identify if a string like "region 1" exists in a row and then gone onto use Switch true to identify where the search result is greater than 0. 

 

This works but only for the rows where the region is the first in the string value. e.g.

 

Region String = "Region 1, Region 2"

Switch Result = "Region 1" 

 

This is really frustrating. I have a look up table i can use, but given rows can have more than 1 region selected - I'm hitting my head against the wall. 

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

Hi @Anonymous ,

 

To create a calculated column as below.

 

Column = 
VAR se =
    SEARCH ( "Region 1", 'Table1'[Region String], 1, BLANK () )
RETURN
    IF ( ISBLANK ( se ), BLANK (), "Region1" )

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share a dataset and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

To create a calculated column as below.

 

Column = 
VAR se =
    SEARCH ( "Region 1", 'Table1'[Region String], 1, BLANK () )
RETURN
    IF ( ISBLANK ( se ), BLANK (), "Region1" )

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @Anonymous ,

 

Does that make sense? If so kindly mark my answer as a solution to close the case. Thanks in advance.

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.