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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
DouweMeer
Impactful Individual
Impactful Individual

iserror is false, but does return an error

Entity =
VAR a1 = find ( " -" , [Classification] )
VAR a2 = len ( [Classification] )
VAR a3 = trim( right ( [Classification] , a2 - a1 -1 ) )
VAR a4 = find ( " -" , a3 )
VAR a6 = trim ( left ( a3 , a4 -1 ) )
RETURN
if ( iserror ( a6 ) , "True" , a6 )
 
The search Text provided to function 'FIND' could not be found in the given text.
 
However...
if ( iserror ( a6) , "True" , "False" ) = "False"
 
I don't understand how this can even give an error. Am I missing something?
5 REPLIES 5
ChrisMendoza
Resident Rockstar
Resident Rockstar

@DouweMeer -

My guess is you should declare the 4th argument of FIND ( ) as BLANK ( ). Something like:

= FIND ( " -", 'Table'[Column1], ,BLANK ( ) )





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Hey @ChrisMendoza 

 

I wasn't so much looking for a workaround, more a like an understanding of why the iserror appears to fail. As for the solution, I created myself the following : 

 

Entity =
VAR a1 = find ( " -" , [Classification] )
VAR a2 = len ( [Classification] )
VAR a3 = trim( right ( [Classification] , a2 - a1 -1 ) )
VAR a4 = if ( iserror ( find ( " -" , a3 ) ) , BLANK() , find ( " -" , a3 ) )
VAR a6 = if ( a4 = BLANK() , BLANK() , trim ( left ( a3 , a4 -1 ) ) )
RETURN
if ( iserror ( a6 ) , 'AC'[Wholesaler Name] , a6 )
 
As a test I changed my original to your suggestion: 
 
Entity =
VAR a1 = find ( " -" , [Classification] )
VAR a2 = len ( [Classification] )
VAR a3 = trim( right ( [Classification] , a2 - a1 -1 ) )
VAR a4 = FIND ( " -", a3 ,BLANK ( ) )
VAR a6 = if ( a4 = BLANK() , BLANK() , trim ( left ( a3 , a4 -1 ) ) )
RETURN
if ( iserror ( a6 ) , "True" , a6 )
 
This returns the following error :
 
An argument of function 'FIND' has the wrong data type or has an invalid value.
 
I wouldn't mind to validate another attempt if you want to give it another shot via your method.  


@DouweMeer wrote:

Hey @ChrisMendoza 

 

...

As a test I changed my original to your suggestion: 
 
Entity =
VAR a1 = find ( " -" , [Classification] )
VAR a2 = len ( [Classification] )
VAR a3 = trim( right ( [Classification] , a2 - a1 -1 ) )
VAR a4 = FIND ( " -", a3 ,BLANK ( ) )
VAR a6 = if ( a4 = BLANK() , BLANK() , trim ( left ( a3 , a4 -1 ) ) )
RETURN
if ( iserror ( a6 ) , "True" , a6 )
 
This returns the following error :
 
An argument of function 'FIND' has the wrong data type or has an invalid value.
 
I wouldn't mind to validate another attempt if you want to give it another shot via your method.  

 

You missed the comma in

VAR a4 = FIND ( " -", a3 ,BLANK ( ) )

Should be 

VAR a4 = FIND ( " -", a3, ,BLANK ( ) )

 

Can you provide a sample of your data?






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



@ChrisMendoza 

 

Felt a bit like:

 

who-would-win-one-misplaced-a-bunch-of-code-semicolon-22745985.png

Your suggestion was able to replace the if iserror boolean. Afterwards I read to documentation. Learned something new today :).

 

Do you, by any chance, know why my first solution didn't worked?

@DouweMeer -

I do not know the reason for the failure. In a sample I created I did not receive a failure. That is the reason I asked for a sample from you 🙂






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors