This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Hi all,
I am an occasional user of Power BI so I tend to forget fundamentals sometimes,I am trying to create "measure" using DAX Search and Switch function, Basically, I am looking at sentences created as cells for keywords.
I used following formula but its showing error w.r.t table values.
Solved! Go to Solution.
Hi @ramhariessentia ,
Since you are creating a Measure, it is needed to use MAX, MIN, SELECTEDVALUE, etc. to specify the current row. Try this:
Category =
SWITCH (
TRUE (),
SEARCH ( "CANCEL", MAX ( 'Final'[Note-0] ), 1, 0 ) > 0, "CANCEL",
SEARCH ( "DELETE", MAX ( 'Final'[Note-0] ), 1, 0 ) > 0, "CANCEL",
SEARCH ( "REJECT", MAX ( 'Final'[Note-0] ), 1, 0 ) > 0, "CANCEL"
)
Or, you can also use CONTAINSSTRING function:
Category 2 =
SWITCH (
TRUE (),
CONTAINSSTRING ( "CANCEL", MAX ( Final[Note-0] ) ), "CANCEL",
CONTAINSSTRING ( "DELETE", MAX ( 'Final'[Note-0] ) ), "CANCEL",
CONTAINSSTRING ( "REJECT", MAX ( 'Final'[Note-0] ) ), "CANCEL"
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ramhariessentia ,
Since you are creating a Measure, it is needed to use MAX, MIN, SELECTEDVALUE, etc. to specify the current row. Try this:
Category =
SWITCH (
TRUE (),
SEARCH ( "CANCEL", MAX ( 'Final'[Note-0] ), 1, 0 ) > 0, "CANCEL",
SEARCH ( "DELETE", MAX ( 'Final'[Note-0] ), 1, 0 ) > 0, "CANCEL",
SEARCH ( "REJECT", MAX ( 'Final'[Note-0] ), 1, 0 ) > 0, "CANCEL"
)
Or, you can also use CONTAINSSTRING function:
Category 2 =
SWITCH (
TRUE (),
CONTAINSSTRING ( "CANCEL", MAX ( Final[Note-0] ) ), "CANCEL",
CONTAINSSTRING ( "DELETE", MAX ( 'Final'[Note-0] ) ), "CANCEL",
CONTAINSSTRING ( "REJECT", MAX ( 'Final'[Note-0] ) ), "CANCEL"
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Looks like you just had an extra comma at the end.
Category =
SWITCH (
TRUE (),
SEARCH (
"CANCEL",
'Final'[Note-0],
1,
0
) > 0, "CANCEL",
SEARCH (
"DELETE",
'Final'[Note-0],
1,
0
) > 0, "CANCEL",
SEARCH (
"REJECT",
'Final'[Note-0],
1,
0
) > 0, "CANCEL"
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.