Tableau error message "expected end to match if at character 0

713 Views Asked by At

I am trying to clean some free form data in a SAGE database so that we can quickly group entries into our accounts by supplier and therefore improve our management reporting. I have written the following code:

if contains([Narrative], "PA") then "Press Association"
elseif contains([Narrative], "Runningball") or contains([Narrative], "IPTV") then "Runningball"
elseif contains([Narrative],"Betradar") or contains([Narrative], "Sportradar") or contains([Narrative], "SPORTRAD") then Sport Radar
elseif contains([Narrative], "Abelson" then "Abelson"
elseif contains([Narrative], "SIS") then "SIS" 
elseif contains ([Narrative], "TX") then "TX"
elseif contains([Narrative], "Two Up") then "Two Up"
elseif contains([Narrative], "Champion Data") then "Champion Data"
END 

I am then getting the message "Expected End to Match If at Character 0" but cannot see what I have done wrong. Any help is much appreciated

Thanks

Craig

1

There are 1 best solutions below

1
On

https://help.tableau.com/current/pro/desktop/en-us/functions_functions_logical.htm

Seems like you need to explicity mention ELSE before ending the if statement which you have not:

elseif contains([Narrative], "Two Up") then "Two Up"
else "Champion Data"
END