Calculating percent with CASE and AVG