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

totaling question 1

Status
Not open for further replies.

anationalacrobat

Technical User
Dec 18, 2007
101
US
Here's a question about totaling. The data I'm getting back looks something like this:

customerid year dollars
1 07 $50
1 08 $250
2 07 $100
2 08 $20
(full list is much bigger, customer ID's not sorted together)

now what I need to do is create four totals for this entire list showing whether the 08 dollars are the same, increase, decrease, or zero.

The part I'm not sure on is how and where to perform this evaluation. If I were doing this manually in Excel, I'd stick in a tally column with nested ifs performing the logic test (if the custID on this line = custID of above line, then) and returning the strings same, increase, decrease, or zero, then do counts at the bottom for those strings and there I go.

Naturally, Crystal ain't Excel. But I know there's a smart way of doing this I'm missing. I don't know if there's something I can do within the details section to get the running total or what.
 
Just as a clarification, I know how to do normal conditional running totals as demonstrated here:
I only want to know the total inventory count of widgets, gadgets, and doohickeys that are blue.

if color='blue', add count to running total.

The part that has me scratching my head is the conditional part, needing to find other occurrences of custId in different years.
 
Ok, I just had a brain-drizzle. This is either the right idea or overly-complicating things.

1. Group by ID
2. On the detail row, set variables A and B. A is set to conditionally take the dollar value for year 08, B takes the year for 07.
3. Perform the test, then increment the appropriate running total.
4. Variables A and B are cleared for the next group.

Am I over-complicating it?
 
Yes. No Need to use variables.

Formula1:
if {year}=2008 then {salesField} else 0

Formula2:
if {year}=2007 then {salesField} else 0

Insert summaries by ID on both of these formulas.

Then write a formula to tell if they are increasing or decreasing:

if Sum({@formula1},{ID})=Sum({@formula2},{ID}) then "Same" else
if Sum({@formula1},{ID})>Sum({@formula2},{ID}) then "Increasing" else
"decreasing"


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Ok, I think I grok what you're saying there. Will try it out tomorrow and let you know, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top