Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Selection Criteria for a single forumla Post Reply Post New Topic
Author Message
swinimer
Newbie
Newbie
Avatar

Joined: 25 Jun 2008
Location: Canada
Online Status: Offline
Posts: 3
Quote swinimer Replybullet Topic: Selection Criteria for a single forumla
     Posted: 25 Jun 2008 at 6:41am
Hey guys,
 
I'm new to crystal reports, and I have a quick question...
 
I'm creating a report that has the following set up
 
                           Residential              Commercial            Industrial
 
Cooltown             %change1               %change2            %change3 
 
Notsocooltown              "                             "                            "
 
coolesttown
 
 
all towns
 
 
I have the grouping done by the variable town, however, to put in the % change forumla {(2008 - 2005/2008)*100} for each of the headers (residential, commercial, industrial) is there any way to write the formula so that it only includes residential data?
 
(ie if rtc = 'R' then %change1 = {((2008-2005)/2005)*100}
     if rtc = 'C' then %change2 = {((2008-2005)/2005)*100} etc...)
 
(I've tried the above and it doesn't work....) I'm sure cross tabs are an option, however I'd like to get this to work if possible (the format of my report is set up differently, so I don't want to use crosstabs if possible)
 
Thanks a lot for all help
 
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 25 Jun 2008 at 6:59am
As crystal reports grows vertically - I'm not sure you are going to be able to use a single formula to get %change1, %change2, and %change3 in the format you identified without using a crosstab.


One approach - Create separate formulas to parse out the data.

@formula1
if {table.fieldname}='R' then {table.2008data} else 0

@formula2
if {table.fieldname}='R' then {table.2005data} else 0

@formula3

((@formula1 - @formula2)/@formula2)*100


Hope this helps.

Sarah
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum