Apologies for the potentially misleading subject but I don't know how to describe this problem more accurately.
The situation is this (using XI 3.1 SP4):
A region can have one or more offices where each office is associated with a number of orders - each order has a date for which it was placed and another date for when it was dispatched
order_id
region_id
office_id
order_dt
dispatch_dt
What I'm trying to do is create a summary that breaks down the number of orders that were placed per month but also shows the number of orders that were considered active during that month - by active I mean that they haven't been dispatched.
For example, say that we in the month of January had three orders. In February there were an additional five orders and at the end of February, there were a total of five orders that hadn't been dispatched. In March there were an additional four orders placed and at the end of March, there were a total of eight orders that hadn't been dispatched.
Month | Orders | Open Orders |
---|---|---|
Jan | 3 | 3 |
Feb | 5 | 5 |
Mar | 4 | 8 |
The way to read this is that:
Three orders were placed in January. At the end of January, none of the three orders placed had been dispatched.
Five orders were placed in February. At the end of February, three orders of those that had been placed in January and February had been dispatched.
Four orders were placed in March. At the end of March, four orders of those that had been placed in January, February and March had been dispatched
I've been trying to do this using a running count and a condition around the dispatch date being less than the last day of the order month but this is obviously off the wall as the numbers are incorrect.
Any suggestions and help around how this could be done would be much appreciated.