I'm trying to write a query/report combination that will group my data by distinct Vessel and dates that are within 20 days of each other. So if I have 8 Vessels, the end result would group the vessels into three groups and sum them. If I could figure how to group them this way, I can easily get the sum in the report.
So for example, assuming a 20 days grouping of 8 Vessels, we have the following:
Group 1: Vessel A B/L Date 01/01/02 - $100,000
Vessel A B/L Date 01/15/02 - $1,000,000
Group 2: Vessel A B/L Date 01/31/02 - $2,000,000
Vessel A B/L Date 02/01/02 - $1,000,000
Vessel A B/L Date 02/10/02 - $2,000,000
Vessel A B/L Date 02/15/02 - $1,000,000
Group 3: Vessel A B/L Date 03/31/02 - $2,000,000
Vessel A B/L Date 03/10/02 - $1,000,000
The earliest date for Group 1 is 01/01/02. Add 20 days to this date and the maximum date it could group the data is 01/21/02. So the row with 01/31/02 B/L date would fail and it becomes the earliest date for the next grouping. Add 20 days to this new date and the maximum date it would group is 02/19/02. So then the row with 03/31/02 date would fail and it becomes the earliest date for the next grouping. And so on....
So finally the report will sum up the data for each group, and it will always display the "earliest" B/L date for each group and you'll get only 3 lines:
Vessel A B/L date 01/01/02 $1,100,000
Vessel A B/L date 01/31/02 $6,000,000
Vessel A B/L date 03/31/02 $3,000,000
Thanks for your help,
Travis
So for example, assuming a 20 days grouping of 8 Vessels, we have the following:
Group 1: Vessel A B/L Date 01/01/02 - $100,000
Vessel A B/L Date 01/15/02 - $1,000,000
Group 2: Vessel A B/L Date 01/31/02 - $2,000,000
Vessel A B/L Date 02/01/02 - $1,000,000
Vessel A B/L Date 02/10/02 - $2,000,000
Vessel A B/L Date 02/15/02 - $1,000,000
Group 3: Vessel A B/L Date 03/31/02 - $2,000,000
Vessel A B/L Date 03/10/02 - $1,000,000
The earliest date for Group 1 is 01/01/02. Add 20 days to this date and the maximum date it could group the data is 01/21/02. So the row with 01/31/02 B/L date would fail and it becomes the earliest date for the next grouping. Add 20 days to this new date and the maximum date it would group is 02/19/02. So then the row with 03/31/02 date would fail and it becomes the earliest date for the next grouping. And so on....
So finally the report will sum up the data for each group, and it will always display the "earliest" B/L date for each group and you'll get only 3 lines:
Vessel A B/L date 01/01/02 $1,100,000
Vessel A B/L date 01/31/02 $6,000,000
Vessel A B/L date 03/31/02 $3,000,000
Thanks for your help,
Travis