Calculating Call Shifts on the :30 rather than :00 hour

kmacd6951

Board Regular
Joined
Mar 3, 2004
Messages
58
I have a query I am using and determining which "call_shift" a call came in on.
The problem is the way I have it working right now, I can only get the shifts to be on the hours, I would like to have one break on the half hour.

(i.e. 8 - 12:30, 12:30-5:00, rather than 8-1 and 1-5)

My last attempt (which you see below) I tried adding in a field to calculate the Mins (Min_in) as well as the Hours (which I had before), but that seemed to move me in the wrong direction, as I got an error "You tried to execute a query that does not include the specified expression 'ACALLID' as part of an aggregate function."

Code:
SELECT SWB_A_CALL.ACALLID, SWB_SW_CUSTOMER.AMNEMONIC, SWB_A_CALL.APRIORITY, SWB_A_CALL.ACALLTYPE, Team_Type.Team_Type, Employee_Team.ALASTCOMMAFIRSTNAME, Employee_Team.TEAM, [SWB_SW_PROD_RELEASE Query].SWNAME, Hour([ADATECREATED]) AS Hour_in, Min([ADATECREATED]) AS Min_in, IIf([hour_in]>7 And ([hour_in]<12 And [Min_in]<30),1,IIf(([hour_in]>12 And [Min_in]>=30) And [hour_in]<17,2,IIf([hour_in]>17 And [hour_in]<20,3,4))) AS Call_Shift, SWB_A_CALL.ADATECREATED, SWB_A_CALL.ARESPONDBY, SWB_A_CALL.ADATECLOSED, nhw([ADATECREATED],[ADATECLOSED]," 8:00","20:00") AS [Response Time], SWB_A_CALL.APROBDESC, SWB_A_CALL.ACREATEDBY, SWB_A_CALL.ACASEID
FROM (((SWB_A_CALL LEFT JOIN [SWB_SW_PROD_RELEASE Query] ON SWB_A_CALL.AINSTPRODID = [SWB_SW_PROD_RELEASE Query].SWINSTPRODID) INNER JOIN SWB_SW_CUSTOMER ON SWB_A_CALL.ACUSTOMERID = SWB_SW_CUSTOMER.SWCUSTOMERID) LEFT JOIN Team_Type ON SWB_A_CALL.ACALLTYPE = Team_Type.Type) LEFT JOIN Employee_Team ON SWB_A_CALL.ACLOSEDBY = Employee_Team.SWPERSONID
WHERE (((SWB_A_CALL.ADATECLOSED) Between Date()-1 And Date()));


Here is the code I was using that had it working as long as the shifts changed on the hour:


Code:
SELECT SWB_A_CALL.ACALLID, SWB_SW_CUSTOMER.AMNEMONIC, SWB_A_CALL.APRIORITY, SWB_A_CALL.ACALLTYPE, Team_Type.Team_Type, Employee_Team.ALASTCOMMAFIRSTNAME, Employee_Team.TEAM, [SWB_SW_PROD_RELEASE Query].SWNAME, Hour([ADATECREATED]) AS Hour_in, IIf([hour_in]>7 And [hour_in]<13,1,IIf([hour_in]>12 And [hour_in]<17,2,IIf([hour_in]>16 And [hour_in]<20,3,4))) AS Call_Shift, SWB_A_CALL.ADATECREATED, SWB_A_CALL.ARESPONDBY, SWB_A_CALL.ADATECLOSED, nhw([ADATECREATED],[ADATECLOSED]," 8:00","20:00") AS [Response Time], SWB_A_CALL.APROBDESC, SWB_A_CALL.ACREATEDBY, SWB_A_CALL.ACASEID
FROM (((SWB_A_CALL LEFT JOIN [SWB_SW_PROD_RELEASE Query] ON SWB_A_CALL.AINSTPRODID = [SWB_SW_PROD_RELEASE Query].SWINSTPRODID) INNER JOIN SWB_SW_CUSTOMER ON SWB_A_CALL.ACUSTOMERID = SWB_SW_CUSTOMER.SWCUSTOMERID) LEFT JOIN Team_Type ON SWB_A_CALL.ACALLTYPE = Team_Type.Type) LEFT JOIN Employee_Team ON SWB_A_CALL.ACLOSEDBY = Employee_Team.SWPERSONID
WHERE (((SWB_A_CALL.ADATECLOSED) Between Date()-1 And Date()));

Any suggestions on how I can tell this to break on the half hours?
Thank you
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,221,825
Messages
6,162,190
Members
451,752
Latest member
majbizzaki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top