## 9 replies

Last post Mar 14, 2013 05:30 AM by Ajay2707

Member

133 Points

222 Posts

### sum in subreport

Hi all,
I have a Crystal Report report that shows the data like this:
product   price  qty       Vat
1020      10,00     2        10
1050      20,00     1
10
1060      30,00     1        20
1080      50,00     2        20

and in the footer I have a subreport that I groups according to Vat, then
price     Vat
40,00      10
130,00    20

I want a field that summarizes price, so:
price      vat
40,00      10
130,00    20
tot. price 175.00

how do you?

thank you very much

bye

Participant

1067 Points

545 Posts

### Re: sum in subreport

you can say select sum(price), .... where..... GROUP BY vat WITH ROLLUP

Contributor

6602 Points

1742 Posts

### Re: sum in subreport

Hi Dupin,

#### dupin

1020      10,00     2        10
1050      20,00     1
10
1060      30,00     1        20
1080      50,00     2        20

and in the footer I have a subreport that I groups according to Vat, then
price     Vat
40,00      10
130,00    20

how this value comes means if i calculate for value 10 of vat that as per above screen will be 30,000 not 40000 . the same for 20 , how 130000 comes

Are you link parameter of main with sub report? If no. then apply by right click on subreport .

if yes. then check why this data comes wrong. by same parameter value give to sub report by open subreport in another window.

Member

133 Points

222 Posts

### Re: sum in subreport

Hi,

I had not specified which was previously done by multiplying qty, no matter
do this:

product   price  qty       Vat
1020      10,00     1        10
1050      20,00     1
10
1060      30,00     1        20
1080      50,00     1        20

and in the footer I have a subreport that I groups according to Vat, then
price     Vat
30,00      10
80,00      20

I want a field (tot. price) that summarizes price, so:
price      vat
30,00      10
80,00      20
tot. price 110,00 (30,00 + 80,00)

thanks a lot

bye

Contributor

6602 Points

1742 Posts

### Re: sum in subreport

Hi Dupin,

in your sub report , in footer insert field summary give column name and just preview.

Member

133 Points

222 Posts

### Re: sum in subreport

Hi,
but I do not have the opportunity to make a summary of the field that I'm interested in the subreport.
makes me see only the fields in the main report.
but I want to make a summury of various groupings of the subreport ...
thank you very much

Member

133 Points

222 Posts

### Re: sum in subreport

In practice I have this:

product   price    qty      Vat
1020      10,00     1        10%
1050      20,00     1        10%
1060      30,00     1        20%
1080      50,00     1        20%

and in the report footer I have a subreport that I groups according to Vat, so:
price     Vat       sales_tax
30,00      10%       3,00
80,00      20%      16,00

'@sales_tax' is a formula like that:
Sum ({Rows.Amount}, {Rows.Vat}) * ({Rows.Vat} / 100)
and works well.

But how do I get a sum of @sales_tax?
this is my problem!

price     Vat       sales_tax
30,00      10%       3,00
80,00      20%      16,00
tot    19,00

in practice show tot..

thanks a lot

Contributor

6602 Points

1742 Posts

### Re: sum in subreport

Hi Dupin,

As you want "tot    19,00" on footer in subreport.  As earliar told you in subreport you must give summary field which is inbuild functionality of report . just check where you put it and how the value comes. I explain you.

In your subreport if you use group section , and you put summary as you want for particular group . then it sums all the value till the group section value change.

if you are putting in page footer , then it gives total sum value of that field ( may be this will give wrong result).

Yes the main thing is that your report and sub-report link is very proper to get data. you can check by giving parameter value to execute sp or query in sqlserver too.

Member

133 Points

222 Posts

### Re: sum in subreport

Hi Ajay2707,

I can not understand how can I have the sum of the groups, that is, in this case 19.00

thank

Contributor

6602 Points

1742 Posts