cancel
Showing results for 
Search instead for 
Did you mean: 

Formula using results of 2 reports

Former Member
0 Kudos

Hello,

New to Crystal Reports... I have 2 existing reports, and I want to create a report that calculates a metric, using the results of the 2 reports, linked by the grouping that I used in each.

e.g.

- Report A from table 1 counts all shipments by date, grouped by month

- Report B from table 2 sums hours of network outage, grouped by month

I want to calculate (sum of hours outage)/(running total of shipments), and display graphically by month

Working with subreports, I have only been able to pass one single value to the main report, not all values by month to do the math

I would imagine this is a pretty simple task, I have done this using other tools, but have not found a simple way in Crystal Reports yet. Any help would be appreciated

Thanks,

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Guests can't get credit for their answers.

Former Member
0 Kudos

Hi Michael

When we want to create image or any calculation based off two diffrent values from two different tables,at that time we need to use subreport in Crystal Report.Below are the steps to resolve the issue.

1)In main Report inser section (For e.g. Page header A,Page Header B & Page header C)

2) Insert sub report a in page Header A ,Insert sub report b in page Header B.

In Sub report:Create a query as per requirement and stored it in Shared variable.Same for sub report B.

Now we have two sared variable value in main report.Using that values we can calculate for Hour based value.

Hope this will work.

Regards

Asha Lund

Design Engineer.

Former Member
0 Kudos

Asha,

Thanks, this is helpful. But when I create the shared variables, I am still only passing a single value to the main report (the most recent value of the variable). Each subreport contains formulas to calculate values I need and lists them against a date/time. e.g.

Subreport A calcuates outage hours, and shows what datetime the outage started:

Hrs DateTime

Subreport B shows total shipments by datetime:

CountShipments DateTime

Hrs and CountShipments are the shared variables.

I want to divide Sum(Hrs)/(CountShipments) and graph for each month.

Any method of doing this that you are familiar with?

Former Member
0 Kudos

Hi Michael

You would need to create an array if you want to get a list of values. Just make it an array instead of using a variable.

For the syntax, you can refer to the Crystal Help.

Hope it helps!!!

Regards

Sourashree

Former Member
0 Kudos

Try creating a seperate report for the graph that consist of both the tables linked and insert a chart by grouping on dates and then insert this report as a subreport in the existing report at footer level without any subreport links.

I Hope this could help you !

Raghavendra