How do you calculate the max # of sales in a 5 day period?

What do you mean when you say "max?" Which day of 5 specific days had the most sales? Does your table have one row per day or one row per sale?

Assuming you had one row per sale, then the number of sales per day would be given by:

   select date, count(*) from sales    group by date

To restrict to a 5-day window, you use a where clause:

   select date, count(*) from sales    where date between ? and ?    group by date

To get the date with the highest, you can do something like this with MySQL:

   select date, count(*) from sales    where date between ? and ?    group by date    order by 2 desc    limit 1

In AR you write that as:

   Sales.count :conditions => ['date between ? and ?', d1, d2],      :group => 'date',      :order => '2 desc',      :limit => 1

That will return an array with one element, which in turn is an array with two elements: a date, and a number representing the count of rows for that date.

HTH