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!

How to use subtotals in calculations in Footer section

Status
Not open for further replies.

zeekay

Programmer
Nov 15, 2009
18
0
0
GB
Hi All,

I am writing a report in Crystal on employees table. The report is grouped on departments column. It shows employees of department 10 and their salary totals, then department 20 and their salary totals and so on. In footer, I am showing grand total. I need to show some more calculations in the footer like ratios of departments for which I want to use sub-totals of departments. For example, divide salary total of department 10 by total of department 20 etc. Is there any way to do this in Crystal? How can I use the sub-totals in footer section for further calculations?

Thanks.
 
If you don't have row inflation (duplicate rows), you could create conditional formulas like this:

//{@dept10salary}:
if {table.dept} = 10 then {table.salary}

Repeat for other departments. Then you could insert a sum at the grand total level. In a formula, you could do calculations like this:

sum({@dept10salary})/sum({@dept20salary})

You can also use running totals, where you specify the department in a formula in the evaluation section:

{table.dept} = 10

...and reset never. Then you would use the running totals in the calculations in the report footer. It's just that conditional formulas are more efficient.

-LB
 
Thanks Ibass for your reply.

Is there a way to avoid hard coding the department numbers in formulas? I am displaying one department on each page. I want the formula to return sum of salary or any other element only for the current department.
I mean, if I am seeing department 10 page, then formula in footer should be showing sum values of the same department. On next page, it should be changed according to department number.
 
You seem to be saying something different from your first post where you said you wanted to compare summaries BETWEEN departments. If you just want summaries within a department, insert summaries on the detail fields at the department group level. If you need to use the summaries in comparisons, just add the department group condition, e.g.,

sum({table.salary},{table.department}) * 123

-LB
 
How to display parameter with multiple selection ??? Any has any tips of how to do so. It is very much appreciate.
 
ngoctran,

You should have started a new thread as this topic is unrelated to the current thread. Please see faq767-5684 for help on this topic.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top