Assuming your table has the folloiwng fields:
Book ID InvDate Stock
001 1/1/2003 50
001 1/8/2003 20
001 1/15/2003 5
001 1/22/2003 0
You want to know that book 001 went on sale on 1/1/2003 and lasted for 3
weeks. I suggest making a query of this table. Set the query to an
aggregate type (click on the summation button in the tool bar). In the
query, include as the fields
Book ID StartSale:Min(InvDate)
Length
ateDiff("ww",Min(InvDate),Max(InvDate))
For Book ID set the group row to Group By, and for the rest set to
Expression. This should give you the result:
001 1/1/2003 3
Let me know if you need more help.
Kelvin
iris said:
Hi Kelvin --
Thanks so much for responding.
I'm new to all this, so am not quite sure what data would be helpful to
you. The feed that I get has a whole bunch of stuff, but the only piece of
data that I'm really interested in for doing this is the # of items in
stock. Basically, I want to pull the items where the inventory was 0 last
week and then 50 this week (indicating that it is new). I then want to
stamp this week as the first week of sale, and then keep track of it as the
weeks go by. Ultimately, I would like to end up with two columns -- one
that says the week it went on sale, and then one that automatically
calculates the number of weeks on sale.
Is that making sense? If there's anything else I can get you that would
be more helpful, please letm eknow.
I came across the date difference function -- =DateDiff ("ww," [on sale
week], [this week]) -- and feel that that COULD be a piece of the puzzle,
but i'm just not sure how to get that to work... Especially since I don't
really know how to sort out the items that I want in the first place.