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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

0

SEARCH function can't search for "."

I was using switch statements to clean up some location data. However, it appears that SEARCH functions can't search for "."

 

Is this true? Yes, I found a way around it, but this seems like something that should be fixed.

 

CS is a var containing the string to be searched.

 

Prob:

Capture.PNG

Fix:

Capture2.PNG

Status: Delivered
Comments
v-yuezhe-msft
Employee

@jengwt,

I am unable to reproduce this issue by using the example below in Power BI Desktop September 2018 version.

Column = LEFT(Table1[CS],(SEARCH(".",Table1[CS])-1))

1.PNG


The above error message is caused by that the search function can't find your text in the stringand it throws an error unless you specify the 4th argument in the search function. You can change the DAX as below.

Column = LEFT(Table1[CS],(SEARCH(".",Table1[CS],,1)-1))

1.PNG




There is a  similar thread for your reference.

https://community.powerbi.com/t5/Desktop/DAX-FIND-or-SEARCH-part-of-a-string-in-a-column/td-p/134518

Regards,
Lydia

v-yuezhe-msft
Employee
Status changed to: Delivered