Starting from your current query, you can just use avg():

SELECT 
    COALESCE(ROLE, 'Summary') ROLE,   
    COUNT(*) AS cases, 
    SUM(CASE WHEN PREPARED = 'Y' THEN 1 ELSE 0 END) AS prepped, 
    AVG(CASE WHEN PREPARED = 'Y' THEN 1 ELSE 0 END) AS ratio_completed
FROM ...

This returns a numeric between 0 and 1. You can replace THEN 1 with THEN 100 if you prefer a percentage (between 0 and 100).

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top