Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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 🙂 

  • Anonymous , I think it should be like

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

     

    Search return position

5 Replies

  • Anonymous , I think it should be like

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

     

    Search return position

    • Anonymous's avatar
      Anonymous
      Not applicable

      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's avatar
        Icey
        Community Support

        Hi Anonymous ,

         

        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