T
tighe
All,
thanks for the advice to get me this far. previously i had asked about a 12
month rolling total, below is the SQl but for Decembers the total is wrong,
can anyone suggest a fix?
AC2007/Xp
thanks in advance.
SELECT Firm_Employee_Count_time.Financial_Month,
Format([Financial_Month],'yyyymm') AS FinMon,
Firm_Employee_Count_time.OccurDate,
[Firm_Employee_Count_time]![OccurDate]-IIf(Right([Firm_Employee_Count_time]![OccurDate],2)=12,111,99)
AS OccurPrevious, Firm_Employee_Count_time.EmployeeCount,
Nz([Firm_Employee_Count_Fired]![EmployeeCount],0)*-1 AS FiredNum,
Nz([Firm_Employee_Count_Hired]![EmployeeCount],0) AS HiredNum,
[FiredNum]+[HiredNum] AS Net,
DSum("Net","Firm_Count_Hired_Fired","Format([Financial_Month], 'yyyymm')<=" &
[Firm_Employee_Count_time]![OccurDate] & " And Format([Financial_Month],
'yyyymm')>=" & [OccurPrevious] & "") AS RunTot
FROM (Firm_Employee_Count_time LEFT JOIN Firm_Employee_Count_Fired ON
Firm_Employee_Count_time.OccurDate = Firm_Employee_Count_Fired.OccurDate)
LEFT JOIN Firm_Employee_Count_Hired ON Firm_Employee_Count_time.OccurDate =
Firm_Employee_Count_Hired.OccurDate
GROUP BY Firm_Employee_Count_time.Financial_Month,
Format([Financial_Month],'yyyymm'), Firm_Employee_Count_time.OccurDate,
[Firm_Employee_Count_time]![OccurDate]-IIf(Right([Firm_Employee_Count_time]![OccurDate],2)=12,111,99),
Firm_Employee_Count_time.EmployeeCount,
Nz([Firm_Employee_Count_Fired]![EmployeeCount],0)*-1,
Nz([Firm_Employee_Count_Hired]![EmployeeCount],0);
thanks for the advice to get me this far. previously i had asked about a 12
month rolling total, below is the SQl but for Decembers the total is wrong,
can anyone suggest a fix?
AC2007/Xp
thanks in advance.
SELECT Firm_Employee_Count_time.Financial_Month,
Format([Financial_Month],'yyyymm') AS FinMon,
Firm_Employee_Count_time.OccurDate,
[Firm_Employee_Count_time]![OccurDate]-IIf(Right([Firm_Employee_Count_time]![OccurDate],2)=12,111,99)
AS OccurPrevious, Firm_Employee_Count_time.EmployeeCount,
Nz([Firm_Employee_Count_Fired]![EmployeeCount],0)*-1 AS FiredNum,
Nz([Firm_Employee_Count_Hired]![EmployeeCount],0) AS HiredNum,
[FiredNum]+[HiredNum] AS Net,
DSum("Net","Firm_Count_Hired_Fired","Format([Financial_Month], 'yyyymm')<=" &
[Firm_Employee_Count_time]![OccurDate] & " And Format([Financial_Month],
'yyyymm')>=" & [OccurPrevious] & "") AS RunTot
FROM (Firm_Employee_Count_time LEFT JOIN Firm_Employee_Count_Fired ON
Firm_Employee_Count_time.OccurDate = Firm_Employee_Count_Fired.OccurDate)
LEFT JOIN Firm_Employee_Count_Hired ON Firm_Employee_Count_time.OccurDate =
Firm_Employee_Count_Hired.OccurDate
GROUP BY Firm_Employee_Count_time.Financial_Month,
Format([Financial_Month],'yyyymm'), Firm_Employee_Count_time.OccurDate,
[Firm_Employee_Count_time]![OccurDate]-IIf(Right([Firm_Employee_Count_time]![OccurDate],2)=12,111,99),
Firm_Employee_Count_time.EmployeeCount,
Nz([Firm_Employee_Count_Fired]![EmployeeCount],0)*-1,
Nz([Firm_Employee_Count_Hired]![EmployeeCount],0);