I have an absence database which records the first day ([startdate]) and the last day ([enddate]) of an absence. I am able to count the length of the absence in days between these 2 dates ([nofda]) , having holidays and weekends discounted so we are left with just the workdays value.
Now I have been asked to produce some graphs to show the total amount of absence days by month over any given time frame. Currently there's around 450 individual records present.
This is where my problem begins.
I already have form where we can set a range of parameters to filter records and then have a temp query created based on these criteria.
I have summed up the total days absent and grouped it by month using a sub query based upon this temp query and use this as the source for the graph.
The chart I created seemed fine at first glance, until I realised that the values shown on the graph do not 'split'. By that I mean if an absence started in January and ended in February for a total of 20 absence days, 10 of those days were in January and the other 10 in February.
This is highlighted even more when a member of staff has been off for several months. They went off sick in January and returned in September. The total number of absence days 180 (for example) is counted in it's entirety in the total for January and not spread over the months inbetween which of course skews the graph somewhat.
I have spent the last few days trying and failing to unpick this one. There is of course an enddate field which I clearly need to have included somewhere in these querys but I have not been able to get it right.
As this is the closest I have gotten, this is probably what I will have to run with and hope the boss doesn't drag me over the carpet!
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The SQL I am using to drag out the figures from the temp query is
'Qry name [QRY_Absence_Chart_By_Month]
SELECT Sum(qryTemp.NOfDA) AS SumOfNOfDA, Format(DateSerial(Year([startdate]),Month([startdate]),1),"mmmm yy") AS MonthYear
FROM qryTemp
GROUP BY Format(DateSerial(Year([startdate]),Month([startdate]),1),"mmmm yy")
HAVING (((Sum(qryTemp.NOfDA))>0))
ORDER BY Format(DateSerial(Year([startdate]),Month([startdate]),1),"mmmm yy");
The row source for the graph is:
SELECT [MonthYear],Sum([SumOfNOfDA]) AS [SumOfSumOfNOfDA] FROM [QRY_Absence_Chart_By_Month] GROUP BY [MonthYear];
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Any advice will be GREATLY appreciated.
Cheers,
Jack
Now I have been asked to produce some graphs to show the total amount of absence days by month over any given time frame. Currently there's around 450 individual records present.
This is where my problem begins.
I already have form where we can set a range of parameters to filter records and then have a temp query created based on these criteria.
I have summed up the total days absent and grouped it by month using a sub query based upon this temp query and use this as the source for the graph.
The chart I created seemed fine at first glance, until I realised that the values shown on the graph do not 'split'. By that I mean if an absence started in January and ended in February for a total of 20 absence days, 10 of those days were in January and the other 10 in February.
This is highlighted even more when a member of staff has been off for several months. They went off sick in January and returned in September. The total number of absence days 180 (for example) is counted in it's entirety in the total for January and not spread over the months inbetween which of course skews the graph somewhat.
I have spent the last few days trying and failing to unpick this one. There is of course an enddate field which I clearly need to have included somewhere in these querys but I have not been able to get it right.
As this is the closest I have gotten, this is probably what I will have to run with and hope the boss doesn't drag me over the carpet!
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The SQL I am using to drag out the figures from the temp query is
'Qry name [QRY_Absence_Chart_By_Month]
SELECT Sum(qryTemp.NOfDA) AS SumOfNOfDA, Format(DateSerial(Year([startdate]),Month([startdate]),1),"mmmm yy") AS MonthYear
FROM qryTemp
GROUP BY Format(DateSerial(Year([startdate]),Month([startdate]),1),"mmmm yy")
HAVING (((Sum(qryTemp.NOfDA))>0))
ORDER BY Format(DateSerial(Year([startdate]),Month([startdate]),1),"mmmm yy");
The row source for the graph is:
SELECT [MonthYear],Sum([SumOfNOfDA]) AS [SumOfSumOfNOfDA] FROM [QRY_Absence_Chart_By_Month] GROUP BY [MonthYear];
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Any advice will be GREATLY appreciated.
Cheers,
Jack