Rolling Twelve Month Count

This inventory report shows all "Item Numbers" that have fallen below their set "Reorder Point." This report allows our parts manager to walk the aisles and confirm quantities before placing an order. The report uses the "Inventory" table to produce these numbers.

He would find it very helpful if I could display a rolling twelve month count of the number (or quantity) of each item sold. To do this, I'll need to incorporate the "Invoices" table and loop through the table getting a count (over the last twelve months) of the number sold for each Item Number. For example; maybe we sold 14 of Item#1101600030 and 33 of Item#1102400016 and 0 of Item#1102400017 (the first three records below).

Parts Order Report
I've not encountered a situation like this before (in Crystal). What is the best way to go about getting a count for the number of each item sold...keeping in mind that it cannot change record selection as the report is meant to display items that have fallen below their Reorder Point. For those items, I only wish to display how many of each were sold over the last twelve months.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
One option is to place in that column a linked subreport (or a correlated SQL Expression) that returns the desired total.

Another option is to do an outer join to the "invoices" table, group on Item Number.  Show the item row data in the Group Footer, and display a conditional total (condition being on the invoice data range) of the quantity from the invoice also in the group footer.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Forgot to mention: consider adding a ratio to the report of (12*On Hand)/(12 Month Sales).
This would allow the manager to easily recognize how many months of inventory you have on hand.
Create a view which groups the data by item and calculates the count. Set the where clause to the last 12 months. Join the view with your current data by the item's id ...
Building on IdoMillet's idea of the conditional sum

Add a group on the Item Number.  
Suppress the group header and footer

You can build a formula like
If {InvoiceDate} >= DateAdd('yyyy',-1,CurrentDate) Then

Open in new window

You could then use a summary on the formula to get the total sold in the time frame.  Put the summary in the detail section.

Bad_FishAuthor Commented:
I employed IdoMillet's suggestion and it works great. Thanks to everyone!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.