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.
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 🙂
Solved! Go to Solution.
@byte007 , I think it should be like
SearchFeature = SWITCH (
TRUE (),
SEARCH ( "Oranges", 'Query1'[Column],, 0 ) > 0, "Oranges",
"Others")
Search return position
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)
@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
@byte007 , I think it should be like
SearchFeature = SWITCH (
TRUE (),
SEARCH ( "Oranges", 'Query1'[Column],, 0 ) > 0, "Oranges",
"Others")
Search return position
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 🙂
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |