cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
YGoe
New Member

Search text DAX not working

Dear All, 

 

I am trying to perform an if test on a column that contains strings. After searching the web, I decided to use the search function. 

I keep running in an error telling me that a single value cannot be determined (please see snap shot below) I know for a fact that what I am looking for does exist and only appears once in the entire database! the function is here :


test = if(SEARCH("Transient Retail",'home accounts'[acc_name],,0)<>0,10,0)

 

Many thanks, 

 

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
sokg Solution Supplier
Solution Supplier

Re: Search text DAX not working

Is home accounts{acc_name] already a calculated column?

 

Try this one as a column

 

test = IF(IFERROR(SEARCH("Transient Retail",'home accounts'[acc_name]),-1)=1,10,0)

 

View solution in original post

15 REPLIES 15
sokg Solution Supplier
Solution Supplier

Re: Search text DAX not working

Hi @YGoe

 

Try this instead

 

test = IF(IFERROR(SEARCH("Transient Retail",'home accounts'[acc_name],-1)=1,10,0)

 

Note this:   The search function is case insensitive

YGoe
New Member

Re: Search text DAX not working

 Hi @sokg,

 

I tried what you proposed and the error remains.

there is an error that is linked to the column 'home accounts'[acc_name] as it has a red line underneath it. 

 

I honestly do not know why. You may find below a snapshot of the table accounts

 

Capture 2.PNG

sokg Solution Supplier
Solution Supplier

Re: Search text DAX not working

Could you give a print screen from the error you get with my formula

 

YGoe
New Member

Re: Search text DAX not working

@sokg there you go. 

 

Capture 3.PNG

sokg Solution Supplier
Solution Supplier

Re: Search text DAX not working

At the end you have 2 parenthesis. You need only one.

Highlighted
YGoe
New Member

Re: Search text DAX not working

I already tried removing brackets and moving the ,0 outside the first bracket. but it is still not working. 

 

I dont know why the selected column is not being recognised properly. 

 

is there another way to perform an if test on varchar datatype instead of numeric?

 

thanks,

sokg Solution Supplier
Solution Supplier

Re: Search text DAX not working

Not brackets[ ] , i said parenthesis ( ) . You have two at the end. Capture.JPG

YGoe
New Member

Re: Search text DAX not working

@sokg it is not solving the issue

 

Capture 4.PNG

sokg Solution Supplier
Solution Supplier

Re: Search text DAX not working

Sorry my mistake, it was missing one parethesis after your column name

 

try this

 

test = IF(IFERROR(SEARCH("Transient Retail",'home accounts'[acc_name]),-1)=1,10,0)

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors