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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

search

Hi,

What does this dax do please?

SEARCH("SP*",[fieldname],1,0) > 0

 

Thanks

1 ACCEPTED SOLUTION

hi, @Anonymous  

As the document said, 

Term Definition
find_text The text that you want to find.

You can use wildcard characters — the question mark (?) and asterisk (*) — in find_text. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

 

https://docs.microsoft.com/en-us/dax/search-function-dax

 

This formul  SEARCH("SP*",[fieldname],1,0) > 0 equals SEARCH("SP",[fieldname],1,0) > 0

It returns that if there is "SP" in the field, it will return ture.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
tex628
Community Champion
Community Champion

It searches the field "Fieldname" for the textstring "SP*" and if it finds it, it returns the index otherwise a 0. 

https://docs.microsoft.com/en-us/dax/search-function-dax


Connect on LinkedIn
Anonymous
Not applicable

Hi,

I investigated further, it looks to find any text that begins with SP, rather than SP*

i.e. it returns sp1, sphello


, etc.
But how can I check for string that begins with SP* and do not want to use * as wild card

Thank you

hi, @Anonymous  

As the document said, 

Term Definition
find_text The text that you want to find.

You can use wildcard characters — the question mark (?) and asterisk (*) — in find_text. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

 

https://docs.microsoft.com/en-us/dax/search-function-dax

 

This formul  SEARCH("SP*",[fieldname],1,0) > 0 equals SEARCH("SP",[fieldname],1,0) > 0

It returns that if there is "SP" in the field, it will return ture.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tex628
Community Champion
Community Champion

Appear to be correct yes, I can't actually tell if theres any difference between SEARCH("SP" .... ) and SEARCH("SP*" .... ).
But i does work indeed!


Connect on LinkedIn

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.