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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
mkrmenci
New Member

Using Search function within Switch

Hi Folks,

 

I'm trying to create a new query that will search through a column looking for cells that contain specific text. I'm using the SWITCH function and so far its working great.  Example.

 

NewColumn =

SWITCH(

             TRUE(),
             TABLE1[ProcessColumn]="process.exe","Process Application", 

BLANK()

)

 

I would now like to add a search function this time as I want to find cells that may contain the text that I'm looking for. Basically like a wildcard or Like oeprator.  I've got this so far.

 

SWITCH (
              TRUE (),
              SEARCH ( "apache", 'TABLE1'[ProcessColumn],, 0 ) = 1, "Process Application",
BLANK()
)

 

It then throws me this error.

 

To use special characters in a column name, enclose the entire name in brackets ( [] ) and add a ] to any closing brackets in the name.

 

It could be something very obvious that I've done wrong but I've spent some time trying to get the right syntax and it still doesn't like it. Any ideas? Any help would be appreciated.

 

Thanks.

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @mkrmenci

 

I have made a test with your dax expression in Power BI Desktop (Version: 2.56.5023.942 64-bit (March 2018)), everything works well. It seems that your formula should be right,

 

Untitled12.png

 

Please check if you have update the latest Power BI Desktop.

 

By the way, what is your data source and how do you connect it?

 

In addition, you could have a reference of my test pbix file.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @mkrmenci

 

I have made a test with your dax expression in Power BI Desktop (Version: 2.56.5023.942 64-bit (March 2018)), everything works well. It seems that your formula should be right,

 

Untitled12.png

 

Please check if you have update the latest Power BI Desktop.

 

By the way, what is your data source and how do you connect it?

 

In addition, you could have a reference of my test pbix file.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey @v-piga-msft ,

 

This solution seems to be working for me but with >1, instead of =1 : not sure why.

 

I also am not clear what is True() and Blank() doing in the code - those are not standard parameters for the SWITCH function, right?

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.

Top Solution Authors