supportsvc
Technical User
Hello,
So I'm close but can't figure out how to go about only showing the previous quarter sum and then to handle the last quarter to display when ran in the 1st quarter the following year.
This is what I have so far
What and do I change so the Sum is always the Previous Quarter?
So I'm close but can't figure out how to go about only showing the previous quarter sum and then to handle the last quarter to display when ran in the 1st quarter the following year.
This is what I have so far
Code:
SELECT PR_Employee.EmployeeKey, PR_Employee.DepartmentNo, PR_Employee.EmployeeNo, PR_Employee.LastName, PR_Employee.FirstName, PR_Employee.SocialSecurityNo, PR_EmployeeTaxFilingStatus.TaxGroup, PR_EmployeeTaxFilingStatus.FilingStatus, PR_EmployeeTaxFilingStatus.TaxCalculationOverrideCode, Sum(IIf([CalendarMonth] In ("01","02","03"),[WagesSubjToWithholding],0)) AS Q1, Sum(IIf([CalendarMonth] In ("04","05","06"),[WagesSubjToWithholding],0)) AS Q2, Sum(IIf([CalendarMonth] In ("07","08","09"),[WagesSubjToWithholding],0)) AS Q3, Sum(IIf([CalendarMonth] In ("10","11","12"),[WagesSubjToWithholding],0)) AS Q4, (Val([CalendarMonth])+2)\3 AS Quarter
FROM PR_Employee INNER JOIN (PR_EmployeeTaxHistory INNER JOIN PR_EmployeeTaxFilingStatus ON (PR_EmployeeTaxFilingStatus.TaxGroup = PR_EmployeeTaxHistory.TaxGroup) AND (PR_EmployeeTaxHistory.EmployeeKey = PR_EmployeeTaxFilingStatus.EmployeeKey)) ON (PR_Employee.EmployeeKey = PR_EmployeeTaxHistory.EmployeeKey) AND (PR_Employee.EmployeeKey = PR_EmployeeTaxFilingStatus.EmployeeKey)
WHERE (((PR_EmployeeTaxHistory.CalendarYear)=Year(Date())))
GROUP BY PR_Employee.EmployeeKey, PR_Employee.DepartmentNo, PR_Employee.EmployeeNo, PR_Employee.LastName, PR_Employee.FirstName, PR_Employee.SocialSecurityNo, PR_EmployeeTaxFilingStatus.TaxGroup, PR_EmployeeTaxFilingStatus.FilingStatus, PR_EmployeeTaxFilingStatus.TaxCalculationOverrideCode, (Val([CalendarMonth])+2)\3
HAVING (((PR_EmployeeTaxFilingStatus.TaxGroup)<>"FEDERAL"));
What and do I change so the Sum is always the Previous Quarter?