Hi @anucharbe,
The "nested summary functions" are Sum(...) and count(...). Within each combination of Month and MailerTurnAroundTime values you want to count the distinct Patient_id values, which is fine. But then how does the SUM function come into play? I suspect that you mean the sum of the counts across Month-MailerTurnAroundTime combinations, not within these groups, i.e., the GROUP BY clause should not apply to the SUM function. This would require another (nested) inline view, for example:
select Month, MailerTurnAroundTime, sum(npat) as Counts
from (select Month, MailerTurnAroundTime, count(distinct Patient_id) as npat
from (select case when ...)
group by Month, MailerTurnAroundTime);