My memory is not what it used to be... what a horrible feeling that is!
I have a table that track monthly data for several thousand products.
The idea is to grab the first month and the first three months of sales for each product.
So I simply need to have a statement that scans through a predefined set of fields and seeks the first none zero value. This become the first month of sales (even if it is the 5th month of the year). It then needs to be able to grab the proceeding 2 months to create a sum of sales in the first 3 months. (however that would be for a second field, so presumably that is just a slightly more complex version of the same formula used to find the first month of sales)
As I write this out, I realize I may need to write a module to do this.... however I am interested to know if a query can handle it. Any advice would be appreciated, however advice with leads that can get me on track are even more appreciated =)
I have a table that track monthly data for several thousand products.
The idea is to grab the first month and the first three months of sales for each product.
So I simply need to have a statement that scans through a predefined set of fields and seeks the first none zero value. This become the first month of sales (even if it is the 5th month of the year). It then needs to be able to grab the proceeding 2 months to create a sum of sales in the first 3 months. (however that would be for a second field, so presumably that is just a slightly more complex version of the same formula used to find the first month of sales)
As I write this out, I realize I may need to write a module to do this.... however I am interested to know if a query can handle it. Any advice would be appreciated, however advice with leads that can get me on track are even more appreciated =)