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

Quarterly comparison last year to this year 3

Status
Not open for further replies.

pblazeppd

MIS
Jun 27, 2001
16
US
Hi all,

Version: CR9
Connection: ODBC

Tables: INMAST_VIEW, Primay Key: Case#

Fields: Reported_Date(Date/Time), Nature_of_Call(Text)

Just doing a simple query but, need to compare Q1 2006 to Q1 2007. For Nature_of_Call, I need to count on change of Case#. I would also like to group, Nature_of_Call to group like crimes (Auto Theft and Auto THFTA (Attempts)). Output would be as follows:

2006 2007 % change
Nature_of_Call Q1 Q1
Robbery 40 60 50%
Auto Theft 10 15 50%
Burglary of Hab 5 10 100% Etc.

I have experimented with a crosstab but, have not been able to get it to work. Any and all help is appreciated. I expect this has been addressed, but searching is under maintenance.

Thanks

Phil
 
Use DatePart, Year({Reported_Date}) and DatePart ("q", {Reported_Date}).

You could even use this in selection,
Code:
Year({Reported_Date}) >= (Year(Currentdate)-1)
and
DatePart ("q", {Reported_Date}) = 1
Then group by year, do group totals. Or else a crosstab.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
First, to cluster the values, we would need to know more about the variations in the content of the field, but you could create a formula that does it, like:

if {table.natureofcall} like "*auto*" then "Auto Theft" else
if {table.natureofcall} like "*Burglary*" then "Burglary} else {table.natureofcall}

Then use this as your row field in the crosstab. Next create two formulas:

//{@2006}:
if year(table.date}) = 2006 then 1 //or {table.qty}

//{@2007}:
if year(table.date}) = 2007 then 1 //or {table.qty}

Add these are your first two summary fields, and then create another formula as a place holder and add it as your third summary:

whilereadingrecords;
0

Then go to the customize style tab and check "horizontal summaries" and "show summary label".

Then in preview mode, select the {@2006} summary->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
currencyvar yr2006 := currentfieldvalue;
false

Then do the same for the {@2007} summary, using this formula:
whileprintingrecords;
currencyvar yr2007 := currentfieldvalue;
false

Then select the {@0} summary and right click->format field->common tab->display string->x+2 and enter:
whileprintingrecords;
currencyvar yr2006;
currencyvar yr2006;
totext((yr2007-yr2006)%yr2006,2)+"%" //for 2 decimals

-LB
 
Madawc,

Worked great with a crosstab but, is there a way to get the percentage of change. Crosstab is doing totals...

Thanks

Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top