I can't help out with the SQL bit here Ann but I can suggest something that may speed things up. Have you tried just live connecting to your data source without the Custom SQL and then building out quick filters that filter the data in the same way? I ask because Custom SQL statements 1) have to run as a subquery every time you change your view such that a query executes and 2) we miss out on a lot of query optimizations that can be done by our engine or the DB.
It is possible that switching to a plain live connection with filters may speed things up to where the performance is no longer an issue.
Actually, the case statements helped speed things up by a minute - it's a SAP HANA connection in Tableau that's notoriously slow. I guess I should say I'm still running in Tableau 8.2 (our server isn't upgraded to 9 yet due to an issue with adding users)