I want to calculate subtotal and grand total in the Group footer of a report based on a conditional expression ie., there is a feild with 'A revenue', or 'B capital'. The report look like this:

Demand Major head Amount category

1 2210 gross 10000 A revenue
deduct 500
net (gross-
1 2211 gross 12000 A revenue
deduct 400
net (gross-deduct)
1 4210 gross 5000 B capital
deduct 500
net (gross-deduct)
1 4211 gross 6000 B capital
deduct 500
net (gross-deduct)

In the Demand Group footer the result is to be like this

Subtotal of Revenue (ie sum of (gross-deduct) with 'A revenue'
Subtotal of Capital (ie sum of (gross-deduct) with 'B capital'
Grand total (ie sum of (gross-deduct) with 'A revenue'and 'B capital' .

Please help me in solving the above problem

My email ID is 'Shibufin@yahoo.co.in"