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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cross-tab calculation help

Status
Not open for further replies.

aka45

Programmer
Apr 4, 2006
13
0
0
US
I have two cross-tab as following for Quarter to Date and Month to date. The columns grow according to parameter input.This one is for Q2 of 2005 to Q4 of 2006.

Q205 Q305 Q405 Q106 Q206 Q306 Q406
North 226,624 185,821 271,763 489,886 404,895 293,116 282,458
Total 226,624 185,821 271,763 489,886 404,895 293,116 282,458

Now I have to create a cross tab with % growth using the above cross tab like this:
%growth
QTD
North Q206/Q205
Q306/Q305
Q406/Q405
How can I do this? Do I have to do Manual Cross tab only or I can use Cross tab Itself. If I can use cross tab, please let me know how to grab the values into the variables.

Thanks,
Ak



 
I am using Crystal Reports Version 10. is possible in this version.

Thank you,
AK
 
First create three formulas and add them to your crosstab summary field area in this order:

//{@year1}:
if year({table.date}) = 2005 then
{table.amt}

//{@year2}:
if year({table.date}) = 2006 then
{table.amt}

//{@0}:
whilereadingrecords;
0

Also create {@qtr} and add it as your column field in the crosstab:

datepart("q",{table.date})

While it is selected in the crosstab expert->group options->customize groupname->use a formula->x+2 and enter:

"Qtr "+ totext(datepart("q",{table.date}),0,"")

Add your row field to the crosstab. Then in preview mode, highlight the first summary {@year1}->format field->common->suppress->x+2 and enter:

whileprintingrecords;
numbervar year1 := currentfieldvalue;
false

Then highlight {@year2}}->format field->common->suppress->x+2 and enter:

whileprintingrecords;
numbervar year2 := currentfieldvalue;
false

Then highlight {@0}->format field->common->DISPLAY STRING->x+2 and enter:

whileprintingrecords;
numbervar year1;
numbervar year2;
if year1 > 0 then
totext(year2 % year1,2,"") + "%"

If you want to, you can go to the customize style tab and check "horizontal summaries" and "show summary labels"--if that's available in 10.0.

-LB
 
My problems is year parameter. It could be 2005 to 2006 or 2004 to 2006. How can I handle this situation? Please shed some light.

Thanks LB
-AK
 
What would you expect for results if you had three years of data? Not sure what the comparisons would be.

Also, is there really a year parameter and if so, what field is it set to? A date field or a number field for year?

-LB
 
The results would like this

Q1-2005/Q1-2004 Q2-2005/Q2-2004 Q3-2005/Q3-2004 Q4-2005/Q4-2004
Q1-2006/Q1-2005 Q2-2006/Q2-2005 Q3-2006/Q3-2005 Q4-2006/Q4-2005


There is a date field from which I am getting the quarter. Year and Month are the two parameters that I have based on which I have the selection criteria

Thanks,
AK


 
So how are you selecting multiple years? Please copy your record selection formula into the post so I can see specifically how you are using the parameters.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top