kentwoodjean
Technical User
I am not sure how to correct it but it appears that my formula for "Weekend" is the capturing the correct time frame. In order words, when I ran the query on Monday of this week, instead of capturing the totals for week ending 4/22, it picked up the totals for week ending 4/15. It always appears to be a week benind the most recent week ending. Can anyone see anything wrong in my SQL?
SELECT Avg([Count BA closedDeptCorp].DeptAge) AS AvgOfDeptAge, Avg([Count BA closedDeptCorp].CorpAge) AS AvgOfCorpAge, Sum(Nz([CountOfClosed Dt],0)) AS [CountClosed Dt], Sum(Nz([CountOfDate1],0)) AS CountDate1, [Closed Dt]-1-Weekday([Closed Dt]) AS Weekend
FROM [Countof Recd Date BA] RIGHT JOIN [Count BA closedDeptCorp] ON [Countof Recd Date BA].Date1 = [Count BA closedDeptCorp].[Closed Dt]
GROUP BY [Closed Dt]-1-Weekday([Closed Dt])
HAVING ((([Closed Dt]-1-Weekday([Closed Dt])) Like "*2005*"));
SELECT Avg([Count BA closedDeptCorp].DeptAge) AS AvgOfDeptAge, Avg([Count BA closedDeptCorp].CorpAge) AS AvgOfCorpAge, Sum(Nz([CountOfClosed Dt],0)) AS [CountClosed Dt], Sum(Nz([CountOfDate1],0)) AS CountDate1, [Closed Dt]-1-Weekday([Closed Dt]) AS Weekend
FROM [Countof Recd Date BA] RIGHT JOIN [Count BA closedDeptCorp] ON [Countof Recd Date BA].Date1 = [Count BA closedDeptCorp].[Closed Dt]
GROUP BY [Closed Dt]-1-Weekday([Closed Dt])
HAVING ((([Closed Dt]-1-Weekday([Closed Dt])) Like "*2005*"));