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

Subtract the same formula but in a different group? 1

Status
Not open for further replies.

Bennie47250

Programmer
Nov 8, 2001
515
US
Reposting as I have not received any responses to the orginal posting.

Using Crystal Version 7.0 against an Access database

I have a report with 5 Different Groups.

Sales Region
Department
GL Account Number
Arm Type
Part Number

In the Arm Type group, there is a Formula named Avg Cost and it dividing a running total of the Qty Sold into the Running Total of the Total Material Cost. This formula is {#GF3TotalCost} / {#GF3Qty}

We have two different types of Arms, Blue and Red

On the report, we have one line that shows on the Blue arms the Avg Cost is $225.63.
Go a few lines down and there is a line that shows on the Red arms, the Avg Cost is 256.36.

I want to be able to subtract the Red Avg Cost from the Blue Avg Cost.

How can this be accomplished?
 
There are a couple of means, I'll show the simpler of the 2, although you didn't state WHERE this is to be displayed.

Create a formula akin to what you currently have, only qualify each divided total as in:

whileprintingrecords;
numbervar BlueValue;
numbervar RedValue;
If {table.armtype} = "Blue" then
BlueValue:={#GF3TotalCost} / {#GF3Qty}
else
If {table.armtype} = "Red" then
RedValue:={#GF3TotalCost} / {#GF3Qty}

Now you can reference the numbervar variables explicitly anytime after the formula executes, as in:

whileprintingrecords;
numbervar RedValue;
"For red it's "& RedValue & "for BlueValue it's "& BlueValue

-k
 
Synapsevampire, do you have your ear’s on? Guess I’m showing my age from the CB craze right after the interstate speed limit was changed to double nickels.

Anyway I’m still fighting this issue and would appreciate more help.

I have not been able to get the desired results.

In my original post I failed to mention WHERE I want subtract the avg RED cost from the avg Blue Cost

I would like it to be shown in the same (Arm Type) Footer as the calculations that determine the avg cost.

I’m not experiences with variables so perhaps that is part on my problem.

Thanks
 
Try this in the Arms Group Footer:

numbervar BlueValue;
numbervar RedValue;
If {table.armtype} = "Blue" then
BlueValue:={#GF3TotalCost} / {#GF3Qty}
else
If {table.armtype} = "Red" then
RedValue:={#GF3TotalCost} / {#GF3Qty};
"For red it's "& RedValue & "for BlueValue it's "& BlueValue

-k
 
OK With your help this is working per your formula.

Now how can I subtract the red value ($279) from the blue value ($179) to show that the red has an higher avg selling price of $100?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top