SELECT dbo_vw_SID_Cal_Month2.SID_Cal_Month_Name, dbo_vw_SID_Date_Dim2.SID_Cal_YYYYMM, sum(dbo.SID_ACD_Fact.Calls_Answered), ( sum(dbo.SID_ACD_Fact.Secs_ASA * dbo.SID_ACD_Fact.Calls_Answered) ) / ( sum(dbo.SID_ACD_Fact.Calls_Answered) ), Convert(numeric,substring(@Prompt('SLA Type',a,{'30 Second SLA','40 Second SLA','45 Second SLA','50 Second SLA','60 Second SLA'},mono,free),1,2)) FROM dbo.Customer_Dim, dbo.vw_SID_Cal_Month dbo_vw_SID_Cal_Month2, dbo.vw_SID_Date_Dim dbo_vw_SID_Date_Dim2, dbo.SID_ACD_Fact WHERE ( dbo.SID_ACD_Fact.CUIC=dbo.Customer_Dim.Cust_CUIC and dbo.SID_ACD_Fact.CustomerIdentifier=dbo.Customer_Dim.Cust_Disp_PriSuf_Num ) AND ( dbo_vw_SID_Date_Dim2.IncidentCloseDate=dbo.SID_ACD_Fact.YYYYMMDD ) AND ( dbo_vw_SID_Cal_Month2.SID_Cal_YYYYMM=dbo_vw_SID_Date_Dim2.SID_Cal_YYYYMM ) AND ( dbo_vw_SID_Date_Dim2.SID_Date_Long <= convert (SMALLDATETIME, {fn CURDATE()}) ) AND ( ( ('Rouse CM Only' = @Prompt('Choose Customer','A',{'Rouse CM Only','Rouse IM Only','IRC Comcast IM, NCC only','LSG Sky Chefs IM Only','NYS IM Only','NYS DOH IM Only','NYS RG Dell IM Only'},mono,free) AND dbo.Customer_Dim.Cust_UPC = 6170244) OR ('Rouse Im Only' = @Prompt('Choose Customer','A',{'Rouse CM Only','Rouse IM Only','IRC Comcast IM, NCC only','LSG Sky Chefs IM Only','NYS IM Only','NYS DOH IM Only','NYS RG Dell IM Only'},mono,free) AND dbo.Customer_Dim.Cust_UPC = 6170244) OR ('IRC Comcast IM, NCC only' = @Prompt('Choose Customer','A',{'Rouse CM Only','Rouse IM Only','IRC Comcast IM, NCC only','LSG Sky Chefs IM Only','NYS IM Only','NYS DOH IM Only','NYS RG Dell IM Only'},mono,free) AND dbo.Customer_Dim.Cust_UPC = 6406604) OR ('LSG Sky Chefs IM Only' = @Prompt('Choose Customer','A',{'Rouse CM Only','Rouse IM Only','IRC Comcast IM, NCC only','LSG Sky Chefs IM Only','NYS IM Only','NYS DOH IM Only','NYS RG Dell IM Only'},mono,free) AND dbo.Customer_Dim.Cust_Client_ID = 6409297) OR ('NYS IM Only' = @Prompt('Choose Customer','A',{'Rouse CM Only','Rouse IM Only','IRC Comcast IM, NCC only','LSG Sky Chefs IM Only','NYS IM Only','NYS DOH IM Only','NYS RG Dell IM Only'},mono,free) AND dbo.Customer_Dim.Cust_UPC = 1396345) OR ('NYS DOH IM Only' = @Prompt('Choose Customer','A',{'Rouse CM Only','Rouse IM Only','IRC Comcast IM, NCC only','LSG Sky Chefs IM Only','NYS IM Only','NYS DOH IM Only','NYS RG Dell IM Only'},mono,free) AND dbo.Customer_Dim.Cust_UPC = 1396345) OR ('NYS RG Dell IM Only' = @Prompt('Choose Customer','A',{'Rouse CM Only','Rouse IM Only','IRC Comcast IM, NCC only','LSG Sky Chefs IM Only','NYS IM Only','NYS DOH IM Only','NYS RG Dell IM Only'},mono,free) AND dbo.Customer_Dim.Cust_UPC = 1396345) ) AND ( dbo_vw_SID_Date_Dim2.SID_Date_Long BETWEEN ( ((DATEADD(MONTH, -1* ( CASE WHEN ( @Prompt('Select the DATE Option','A',{'IncidentClosedDateDim-1 Month Prior','IncidentClosedDateDim-2 Months Prior','IncidentClosedDateDim-3 Months Prior','IncidentClosedDateDim-6 Months Prior','IncidentClosedDateDim-1 Year Prior'},MONO,FREE) ) = 'IncidentClosedDateDim-1 Month Prior' THEN 1 WHEN ( @Prompt('Select the DATE Option','A',{'IncidentClosedDateDim-1 Month Prior','IncidentClosedDateDim-2 Months Prior','IncidentClosedDateDim-3 Months Prior','IncidentClosedDateDim-6 Months Prior','IncidentClosedDateDim-1 Year Prior'},MONO,FREE) ) = 'IncidentClosedDateDim-2 Months Prior' THEN 2 WHEN ( @Prompt('Select the DATE Option','A',{'IncidentClosedDateDim-1 Month Prior','IncidentClosedDateDim-2 Months Prior','IncidentClosedDateDim-3 Months Prior','IncidentClosedDateDim-6 Months Prior','IncidentClosedDateDim-1 Year Prior'},MONO,FREE) ) = 'IncidentClosedDateDim-3 Months Prior' THEN 3 WHEN ( @Prompt('Select the DATE Option','A',{'IncidentClosedDateDim-1 Month Prior','IncidentClosedDateDim-2 Months Prior','IncidentClosedDateDim-3 Months Prior','IncidentClosedDateDim-6 Months Prior','IncidentClosedDateDim-1 Year Prior'},MONO,FREE) ) = 'IncidentClosedDateDim-6 Months Prior' THEN 6 WHEN ( @Prompt('Select the DATE Option','A',{'IncidentClosedDateDim-1 Month Prior','IncidentClosedDateDim-2 Months Prior','IncidentClosedDateDim-3 Months Prior','IncidentClosedDateDim-6 Months Prior','IncidentClosedDateDim-1 Year Prior'},MONO,FREE) ) = 'IncidentClosedDateDim-1 Year Prior' THEN 12 END ), GETDATE()) - day(DATEADD(MONTH, -1, GETDATE()))) ) ) AND ( (GETDATE() - day(getdate())) ) ) ) GROUP BY dbo_vw_SID_Cal_Month2.SID_Cal_Month_Name, dbo_vw_SID_Date_Dim2.SID_Cal_YYYYMM, Convert(numeric,substring(@Prompt('SLA Type',a,{'30 Second SLA','40 Second SLA','45 Second SLA','50 Second SLA','60 Second SLA'},mono,free),1,2))