Hi, everyone.
I need to create a summary report and I'm having trouble constructing the query. Here is a representation of my data table:
And here is what I want my summary report to look like:
Thus, each work order is reduced to one line. Displayed is the date of the most recent survey and the pest count observed on that survey. Also displayed is the "cumulative pest count", which is a running calculation of the number of pests observed at that site.
The cumulative total is sort of an interpolated total. The way the cumulative total formula works is this:
The number of days between the first survey date and the second date is six (1/7/2009 - 1/1/2009). 6 * 20 = 120. So the cumulative total after the second survey is 121, which is 120 plus the prior cumulative total. After the third survey date, the cumulative total is 121 + (3 days * 75 pests) = 346. So 346 would be displayed in the report, along with the 1/10/2009 survey date and the last pest count of 75.
Is this making sense? If not, let me know and I can rephrase.
I'm pretty lost about where to begin on this. Any help would be greatly appreciated.
Thanks,
Duluter
I need to create a summary report and I'm having trouble constructing the query. Here is a representation of my data table:
Code:
[U]FARM WORKORDER SURVEYDATE PESTCOUNT[/U]
MyFarm 2009001 6/12/2009 10
MyFarm 2009002 6/15/2009 5
MyFarm 2009002 6/20/2009 50
TestFarm 2009003 6/10/2009 20
TestFarm 2009003 6/17/2009 100
TestFarm 2009003 6/24/2009 160
TestFarm 2009003 6/30/2009 200
Code:
[U]Farm WorkOrder LastSurveyDate LastPestCount CumulativeCount[/U]
MyFarm 2009001 6/12/2009 10 10
MyFarm 2009002 6/20/2009 50 255
TestFarm 2009003 6/30/2009 200 3040
The cumulative total is sort of an interpolated total. The way the cumulative total formula works is this:
Code:
[U]Date Count[/U]
1/1/2009 1
1/7/2009 20
1/10/2009 75
Is this making sense? If not, let me know and I can rephrase.
I'm pretty lost about where to begin on this. Any help would be greatly appreciated.
Thanks,
Duluter
Last edited: