Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculations with sums from the same group but different time periods 1

Status
Not open for further replies.

metaldude

Technical User
Aug 24, 2005
10
US
i'm new to crystal and this forum and apologize up front for making up my own syntax to try to explain what i mean. i'd love any help anyone can offer.

background:
i have a report that shows sales for 3 diferent quarters. there are 3 groupings: product department, time period sold, and product class. the results of my report so far look like this:

dept num group 0
date range group 0 //QtrMain
class num group 0 $Sold
class num group 1 $Sold
class num group 2 $Sold
class num group 3 $Sold

date range group 1 //QtrPrevious
class num group 0 $Sold
class num group 1 $Sold
class num group 2 $Sold
class num group 3 $Sold

date range group 2 //QtrLastYear
class num group 0 $Sold
class num group 1 $Sold
class num group 2 $Sold
class num group 3 $Sold

dept num group 1
date range group 0 //QtrMain
class num group 0 $Sold
...

i now need to compare each class' $Sold from date range group 0 to those of date range groups 1 and 2.

what i thought i should do is drop each class' $Sold from each grouped quarter into an array so that i can use a for loop to make the calculations and show them in the report. something like this:
compSales := ((QtrMain.Class$Sold/QtrLastYear.Class$Sold) - 1) //sorry, i'm sure my syntax is way off...

here are my questions:
how can i "catch" each class' $Sold value?
do i need a for loop to go through the different classes in each department or is that handled within the grouping?
is there a better way to do what i'm trying to do?
 
Try a crosstab - it's an option under Insert. You might find it gives you exactly what you want, without the need to code it yourself.

If it doesn't, then create running totals for each code, using the formula selection and accumulating for the entire report.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
hi madawc. thank you for your speedy reply. i apologize for the time it took me to get back with an update.

the crosstab and the running total suggestions nailed both of my biggest issues. that was awesome. now the report shows the comp sales AND looks good. sweet! thank you for taking the time to help me out. i'm about to go on vacation having hit a great milestone thanks to you. i really appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top