JetJack
JetJack

Reputation: 988

How to group the subtotal in the report

using crystal report 7

Single report (no sub report added, group by id)

ID Value total

001 100 2000
001 200 3000
-------------
total 300 5000 (a)

002 300 1000
002 200 2000
-------------
total 500 3000 (b)

003 300 1000
003 200 2000
-------------
total 500 3000 (c)

......

I have n number of subtotal like a, b, c ....., each subtotal i want to make subtotal2/ subtotal1 like b/a, c/a .....

Expected Ouput

ID Value total subtotal

001 100 2000
002 200 3000
-------------------
total 300 5000 0

002 300 1000
002 200 2000
-------------------
total 500 3000 0.6

003 300 1000
003 200 1000
-------------------
total 500 2000 0.4

......

How to do it in crystal report.

Can any one give me a idea or formula help

Upvotes: 1

Views: 4464

Answers (1)

Lee Tickett
Lee Tickett

Reputation: 6037

Forgive me, as I have not worked with a version of Crystal that old, but hopefully at least one of these solutions will be suitable:

  • Create a subreport in the report header which will pull the total of group a. Create a formula along the lines: shared numbervar total_a := sum({table.total});
  • In the main report group footer add a formula along the lines: shared numbervar total_a; sum({table.total}) / total_a;

OR similar to the above solution:

  • Create a formula in the report header: global numbervar total_a := 0;
  • Create a formula in the group footer: global numbervar total_a; if total_a = 0 then total_a := sum({table.total}); sum({table.total}) / total_a;

Upvotes: 2

Related Questions