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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
byte007
Frequent Visitor

Wildcard in search function

Hi all,

 

I'm trying to figure out how to use the wildcard within my search code as I don't want to repeat the code over and over so if I have Oranges it will put it in the Oranges catagory but if there is Oranges - big, Oranges - small I want it to appear in the same line as below and I've tried adding * after "Oranges*" but it has no desired change and still only groups Oranges.

 

SearchFeature = SWITCH (
    TRUE (),
              	SEARCH ( "Oranges", 'Query1'[Column],, 0 ) = 1, "Oranges",
"Others")

 

Thanks in advance for any pointers 🙂 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@byte007 , I think it should be like

SearchFeature = SWITCH (
TRUE (),
SEARCH ( "Oranges", 'Query1'[Column],, 0 ) > 0, "Oranges",
"Others")

 

Search return position

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
FrankAT
Community Champion
Community Champion

Hi @byte007 

you can use wildcards '*' and '?' in SEARCH() function, but as @amitchandak mentioned there is no need for your example.

Take a look at: https://docs.microsoft.com/en-us/dax/search-function-dax

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Greg_Deckler
Community Champion
Community Champion

@byte007 - I am not aware of any wildcard matching in SEARCH of FIND or CONTAINSSTRING. Should be able to use CONTAINSSTRING I think.

I usually use something like:

 

SearchFeature = 
  SWITCH (
    TRUE (),
    SEARCH ( "Oranges", 'Query1'[Column],, 0 ) > 0, "Oranges", "Others"
  )

 

I did invent a Fuzzy string matching algorithm just recently though!

https://community.powerbi.com/t5/Quick-Measures-Gallery/Fuzzy/td-p/1352914



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@byte007 , I think it should be like

SearchFeature = SWITCH (
TRUE (),
SEARCH ( "Oranges", 'Query1'[Column],, 0 ) > 0, "Oranges",
"Others")

 

Search return position

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks all for the super pointers 🙂

 

I tried @amitchandak change and this worked a treat for me as I now see the results as expected including adding a ? for the wildcard, this picks up the other oranges big small etc

SearchFeature = SWITCH (
TRUE (),
SEARCH ( "Oranges?", 'Query1'[Column],, 0 ) > 0, "Oranges",
"Others")

 

appreciate the fast replies 🙂

Icey
Community Support
Community Support

Hi @byte007 ,

 

Glad to hear that. Please accept your solution above so that people who may have the same question can get the solution directly. Your contribution is highly appreciated.

 

 

Best Regards,

Icey

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.