Search
Search

# Crystal reports- Calculation between two reports

Hi Experts

I have designed a sales and purchase transaction report using crystal reports and i have designed another report for accounting transactions like Excise Duty payable and receivables, Vat payable and receivables, Expenses(like EB, Maintenance) and so on. Finally I added accounting report as sub-report into First Report.

My question is, is it possible to made some calculations between sub-report and main report.

Hope some solutions from you.

By

Kala

##### Former Memberreplied

Hello,

right upto the linking is good?

Right now you have to create a formula (which you might have already done for "Total expenses", you just need to alternate it slightly.

Example:

On 2nd report (subreport) You might have a formula like given below.

Instead of Numbervar CAvg, which is the last shown value in the below formula, you have to make it like Shared Numbervar CAvg.

```Whileprintingrecords;
Numbervar TJs;
Numbervar TotalJobs=0;
Shared Numbervar CAvg;
Shared Numbervar CAvg=0;
TotalJobs := DistinctCount({lab_credits.credit_no},{lab_credits.reason_code});
CAvg:= TotalJobs /{@WorkingDays};
TJs:=TJs + CAvg;
CAvg
```

Now in the main report you will create another formula which will look like below.

```Whileprintingrecords;
Shared Numbervar CAvg;
Numbervar TAvg:=fieldname;
Numbervar TotalBoth:= Shared Numbervar CAvg+ Numbervar TAvg;
TotalBoth;
```

You will have a reset formula which will be placed ontop of the report header , group header if you are using grouping like this

```Whileprintingrecords;
Shared Numbervar CAvg:=0;
SHared Numbervar TAvg:=0;
```

bearing in mind that we do not have to declare CAvg field here as it is being shared.

Hope this helps

Regards

Jehanzeb

0 View this answer in context