Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set variables in script to highest and 2:nd higest most frequent value

Hello!

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.

Date                   Count

2012-01-15          2500

2012-02-10          12

2012-03-15          2600

2012-03-16          2

2012-05-15          2550

2012-06-01          4

2012-07-15          2700

2012-10-10          2600

2012-11-10          1

2012-12-20          2400

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.

I think it should be done in the script.

Best Regards

Basse

0 Replies