1

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

JetJack
  • 978
  • 8
  • 26
  • 51

1 Answers1

2

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;
Lee Tickett
  • 5,847
  • 8
  • 31
  • 55
  • Thank you for your reply, can you ellaporate you answer, still i am confused. I want to solve this... – JetJack Mar 29 '12 at 07:06
  • Start by trying the second solution. Place the first formula field: `global numbervar total_a := 0;` in the report header, then in your ascii diagram place the second formula where the 0 is (should be the group footer): `global numbervar total_a; if total_a = 0 then total_a := sum({table.total}); sum({table.total}) / total_a;`. What happens? – Lee Tickett Mar 29 '12 at 08:09