Order DateTime, then group by Date (ignoring Time) + other field
As discussed this is gaps/islands problem which just requires isolating the additional distinct groups, using a running count and subtracting a count partitioned by each group of rows:
with grp as (
select Convert(date, [date]) [Date], operation, [count],
Row_Number() over(order by [date])
- Row_Number() over(partition by operation, Convert(date, [date]) order by date) gp
from t
)
select date, operation, Sum([count]) [Count]
from grp
group by [date], operation, gp
order by [date] desc, gp desc
DB Fiddle
I'd probably wind up using a CTE (there's probably a way to do it similar to how you've already tried though). Something along the lines of:
WITH x AS(
SELECT CAST([Date] AS DATE) [Date],
Operation,
SUM(t.[Count]) as [Count]
FROM [MyTable]
GROUP BY CAST([Date] AS DATE),
Operation )
SELECT x.[Date],
x.Operation,
x.[Count]
FROM x AS x
ORDER BY x.[Date] desc,
x.Operation;
Although; if you're going down the route of wanting to show something like:
X calls came before Y visits, then there were another z calls before the end of the day.
Then you'll need something more custom, like the solutions that were linked in in the comments.