I have a report that was made from a union query and then put into a crosstab. I follow the tip FAQ but my problem is each month has different # of days. At the far right hand end I will end up with Totals for each row. I'm using D30-D0 as the dates. Here is the SQL Statement:
PARAMETERS Forms!frmDate!txtEndDate DateTime;
TRANSFORM Max([Stats Query].[MaxOfTime Wkd]) AS [MaxOfMaxOfTime Wkd]
SELECT [Stats Query].EmployeeID, [Stats Query].Expr1003
FROM [Stats Query]
GROUP BY [Stats Query].EmployeeID, [Stats Query].Expr1003, [Stats Query].Expr1
ORDER BY [Stats Query].EmployeeID, [Stats Query].Expr1
PIVOT "D" & DateDiff("d",[Datewkd],Forms!frmDate!txtEndDate) In ("D30","D29","D28","D27","D26","D25","D24","D23","D22","D21","D20","D19","D18","D17","D16","D15","D14","D13","D12","D11","D10","D9","D8","D7","D6","D5","D4","D3","D2","D1","D0");
This works for a month with 31 days in it. If I only have 30 days then when I total it will pull in 1 day from the previous month.
PARAMETERS Forms!frmDate!txtEndDate DateTime;
TRANSFORM Max([Stats Query].[MaxOfTime Wkd]) AS [MaxOfMaxOfTime Wkd]
SELECT [Stats Query].EmployeeID, [Stats Query].Expr1003
FROM [Stats Query]
GROUP BY [Stats Query].EmployeeID, [Stats Query].Expr1003, [Stats Query].Expr1
ORDER BY [Stats Query].EmployeeID, [Stats Query].Expr1
PIVOT "D" & DateDiff("d",[Datewkd],Forms!frmDate!txtEndDate) In ("D30","D29","D28","D27","D26","D25","D24","D23","D22","D21","D20","D19","D18","D17","D16","D15","D14","D13","D12","D11","D10","D9","D8","D7","D6","D5","D4","D3","D2","D1","D0");
This works for a month with 31 days in it. If I only have 30 days then when I total it will pull in 1 day from the previous month.