I have a below query which is trying to use multiple CTE\'s and at the end it get distinct counts for multiple cases I have.
WITH dates AS ( SELECT (DATE_TRUNC(\'