caches case-when statement for better performance