Skip to Content
0
Former Member
Dec 02, 2008 at 09:59 AM

Formula returning incorrect values

25 Views

I have a report which calculates a quantity of products sold over a date range by month (confirmed with a parameter). I then have a formula ({@Qty sold per month}) to work out the average quantity sold per month based on the number of months selected:

If {ProductAnalysis.QuantitySold} > 0

and {ProductAnalysis.CalendarMonth}=minimum({?daterange}) to maximum({?daterange})

then {@Qty sold}/(maximum({?daterange})-minimum({?daterange})+1)

else 0

The {@Qty sold} formula is simply:

SUM ({ProductAnalysis.QuantitySold}, {@Product code and description})

When viewing the data the {@Qty sold per month} formula returns some products correctly, but others show a value of 0. This includes products where there have been sales over the dates specified. In the example I tested I used a 3 month period, and at first thought products that only had sales for 1 or 2 of those months were causing the problem, but there are also some items with sales over all 3 months.

Perhaps there is an error in my formula? Or is there a different way of doing this?