Tickets Resolved By Employee
USE Database
GO
CREATE PROCEDURE Schema.usp_tbl_SpecificData
AS
SET NOCOUNT ON
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SELECT
ft.TicketID
,dt.TicketType
,dtth.HandledEmployee
,SUM(CASE WHEN dtt.TicketStatus = 'Resolved' THEN 1 ELSE 0 END) as Resolved
FROM
Schema.FactTable as ft (NOLOCK)
INNER JOIN Schema.DimTable as dt (NOLOCK)
ON ft.TicketCharacteristicID = dt.TicketCharacteristicID
INNER JOIN Schema.DimTable2 as dtt (NOLOCK)
ON ft.TicketStatusID = dtt.TicketStatusID
LEFT JOIN Schema.DimTable3 as dtth (NOLOCK)
ON ft.ThreeID = dtth.ThreeID
GROUP BY
dtth.HandledEmployee
,dt.TicketType
,ft.TicketID
END;