try this
SELECT Month(date),Year(Date),
SUM(case when category = 1 then Hours else 0 end) / Count(distinct userid) as Total1,
SUM(case when category = 2 then Hours else 0 end)/ Count(distinct userid) as Total2
FROM timesheet
GROUP BY Month(date),Year(Date)