Need some help with adding a CASE statement for the RunningAccepted column similar to what's happening in the accepted_ct column above that in order to make some adjustments to some counts. I'm not quite sure how I should express it logically.
SELECT DATEADD(DAY, 1, EOMONTH(sts.[Status Change Date], - 1)) sc_date,
CASE
WHEN DATEADD(DAY, 1, EOMONTH(sts.[Status Change Date], - 1)) = '2022-05-01'
THEN count(DISTINCT a.id) + 73
WHEN DATEADD(DAY, 1, EOMONTH(sts.[Status Change Date], - 1)) = '2022-06-01'
THEN count(DISTINCT a.id) -9
WHEN DATEADD(DAY, 1, EOMONTH(sts.[Status Change Date], - 1)) = '2022-07-01'
THEN count(DISTINCT a.id) - 351
ELSE count(DISTINCT a.id)
END AS accepted_ct,
sum(count(DISTINCT a.id)) OVER (
ORDER BY DATEADD(DAY, 1, EOMONTH(sts.[Status Change Date], - 1)))
RunningAccepted,