Set variables in script to highest and 2:nd higest most frequent value
This is my first post in this forum, and I need help..
I'm stuck on how to best do this. Or actually, how to do it all.. I'm not sure how to start. I have a date that is set every 2-3 months or so for a couple of thousands product numbers.. It's the same date for all product numbers. Between this interval of 2-3 months, a couple of product numbers can have new dates assigned do them. So an example for the year 2012 could be.
I want to set two variables to always have the maxdate and the second maxdate, only reflecting the dates that have a count of >100. At the same time I want he product numbers with dates <100 to be included in previous date with a count of >100.
So if the current date is 2012-06-20 I want
maxdate1 = '2012-05-15' and
maxdate2 = '2012-03-15'
The date 2012-03-16 should be grouped with 2012-03-15 and 2012-06-01 with 2012-05-15.