Hello, I'm new to Tableau Prep and appreciate this is probably very basic.
Please can someone help with this calculated field I'm trying to create? I've read multiple Q&A's saying this can't be done in Tableau Desktop so I'm thinking it's not possible in Prep either !?
Ideally I'm wanting one calculated field to display:
IF [usage_type] CONTAINS ('Box') or ('envelope') THEN "Usage"
ELSIF [usage_type] CONTAINS ('DBS') THEN "DBS"
ELSE null
END
Tableau Prep is flagging the first 'THEN' as invalid syntax
I basically want to filter out the 3 (Box, envelopes & DBS) but at the same time group Box & envelopes and keep DBS as separate.
Any help would be greatly appreciated. Thank you.
Hi @Susan Clark ,
The format for contains function is as follows
CONTAINS(string, substring)
Check if the below formula works,
IF CONTAINS ([usage_type],'Box') or CONTAINS([usage_type],'envelope') THEN "Usage"
ELSIF CONTAINS ([usage_type],'DBS') THEN "DBS"
ELSE null
END
Regards,
Ajay
Please upvote and mark as Best Answer, if it helps you :)