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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Jebilaya
Helper III
Helper III

search text not working

I need to return all characters before the "/" in driver name as a new column so i'm using the below DAX but it just errors with "The search Text provided to function 'SEARCH' could not be found in the given text."  I have tried other characters and it's just not finding it.  The driver name column is setup as text.

 

Driver = left('Timeslots HDx Report'[Driver Name],search("/",'Timeslots HDx Report'[Driver Name])-1)
 
Jebilaya_0-1652782519198.png

 

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @Jebilaya ,

 

You need to add the additonal parameter of the SEARCH funcion so your SEARCH should be similar to this:

 

 

SEARCH( "/", 'Table'[Column1],1,1)

 

 

https://dax.guide/search/

 

Has you can see in the documentation if you ommit the last parameter it returns an error.

 

I have placed 1 so that when you do the -1 it does not trow an error on the left text.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Try the iferror with 1 not 0.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @Jebilaya ,

 

You need to add the additonal parameter of the SEARCH funcion so your SEARCH should be similar to this:

 

 

SEARCH( "/", 'Table'[Column1],1,1)

 

 

https://dax.guide/search/

 

Has you can see in the documentation if you ommit the last parameter it returns an error.

 

I have placed 1 so that when you do the -1 it does not trow an error on the left text.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix   Still the same error 😞

 

Jebilaya_0-1652787467054.png

 

Try the iferror with 1 not 0.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



that was great thanks @MFelix  ... now stuck on my next one for the other side.

 

The len part of the function is producing a number when I run it on it's own but when I put it as part of the right statement I get the below error

Jebilaya_0-1652784724812.png

 

Try to add a IFERROR on the Second part of the metric.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Try to add a IFERROR on the Second part of the metric.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors