cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mkrmenci New Member
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

Accepted Solutions
Community Support Team
Community Support Team

Re: Using Search function within Switch

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.
1 REPLY 1
Community Support Team
Community Support Team

Re: Using Search function within Switch

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.