hi,i'm actually looking for intuitive way to determine the peaks in sales. instead of going through hunders of rows to determine the first peak and the last peak of sale, i would rather write sql code to do it for me. i just need to find it more intuitive, more softer.sample codecreate table temp(id int,Y smallint,M smallint,running_percent decimal(6,3),quantity_cum int,productID varchar(10)) insert into tempselect 1,2007,6,0.002,4,'ABC' union allselect 2,2007,7,3.625,1483,'ABC' union allselect 3,2007,8,9.117,5227,'ABC' union allselect 4,2007,9,7.547,8137,'ABC' union allselect 5,2007,10,5.496,10559,'ABC' union allselect 6,2007,11,8.101,13864,'ABC' union allselect 7,2007,12,10.231,18038,'ABC' union allselect 8,2008,1,7.474,21087,'ABC' union allselect 9,2008,2,8.712,24641,'ABC' union allselect 10,2008,3,6.719,27382,'ABC' union allselect 11,2008,4,5.525,29636,'ABC' union allselect 12,2008,5,4.542,31489,'ABC' union allselect 13,2008,6,2.032,32318,'ABC' union allselect 14,2008,7,1.917,33100,'ABC' select * from temp
from this sample code you will see the calculated running_percent telling that the first peak is: 9.117 (year/month 2007/8), the second one 10.231 (2007/12) and the last peak 8.712 (2008/2).to tell what and how to find a peak i believe at least 2 months or two values of running_percent must be in trend (either going up or going down). and also some threshold should be defined because the last peak 8.712 my intuition is telling me that i wasn't actually a peak more a sway and i should ignore that.thank you for your idead. :)