Hi,
I need help fixing my PQL script
CASE
WHEN "SHOPPING_DETAILS_DESC" LIKE '%CRIT% 1%' THEN 'Criteria 1'
WHEN "SHOPPING_DETAILS_DESC" LIKE '%CRIT% 3%' THEN 'Criteria 3'
WHEN "SHOPPING_DETAILS_DESC" LIKE '%CRIT% 5%' THEN 'Criteria 5'
ELSE NULL
END
I am trying task search in a text field (Shopping_Details_Desc) for cases where ‘%CRIT%’ is identified. I would then like the code to assign a Criteria when the number ‘1’, ‘3’ or ‘5’ follow directly after the we wildcard search. I am pulling errors because there are other numbers in the text description and the code is incorrectly assigning them because it is find any any ‘1’ (as an example) that comes after ‘CRIT’ and then calling it a ‘Criteria 1’, even when it is a Criteria 3.
My issue is that sometimes our operators are miss writing the text so we are trying to capture either CRIT or CRITERIA, or anything in between - which is why I want a wild card.
I was able to write a statement in DAX to be able to look for a number assigned directly after the CRIT, but I cannot seem to figure out how to do this in PQL.
Criteria Flag =
VAR CritType = eShopping_Details_Crit_Type]
RETURN
IF(
FIND("1", CritType, 1, 0) > 0,
"Criteria 1",
IF (
FIND("3", CritType, 1, 0) > 0,
"Criteria 3",
IF (
FIND("5", CritType, 1, 0) > 0,
"Criteria 5",
BLANK()
)
)
)
It was really lovely meeting many of you during the PI days last week and really appreciate anyone who can support resolving this!