I am using the following procedure to add a count per item which works fine so far.
How do I have to change this if I also want to get the total count in addition so that it counts all items in that select ?
My procedure:
SELECT RANK() OVER(ORDER BY COUNT(*) desc, policy) [Rank],
policy,
COUNT(*) AS groupCount,
'currentMonth' AS groupName
FROM Log_PE
WHERE CONVERT(DATE, dateEsc, 120) >= CONVERT(DATE, CONVERT(VARCHAR(6), GETDATE(), 112) + '01', 112)
GROUP BY policy
ORDER BY groupCount desc, policy