Skip to Content
avatar image
Former Member

Number not adding up

HI all, I am creating a report with a sub report.

The sub report will pass a value to the same report detail. At the end, I will want to Sum up the value. I have issue adding up the value as I Share the value from the sub report.

Can anyone advise what is the work around?

In my report, I have a group which is "Category". I need to have the sub total of Category and grand total.

My share value in the main report named as "ShareAmt".

My report looking something like this .

I am unable to get the Total amount of 300 and 600 and grand total of 900.

Tried to created another sub report, the sub total for dinner only show 200and the sub total for lunch always show 100 only.

Noticed for total it always only show the last invoice amount.

Please advise.

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 02 at 07:27 AM

    Hi Mavis,

    Assuming "ShareAmt" is the variable that shows the "Amount", here's what you need to do:

    1. Modify the ShareAmt formula like so:

    shared numbervar amt; //Replace this variable with the shared variable that shows Amount
    shared numbervar stot := stot + amt;
    amt; //Replace this variable with the shared variable that shows Amount

    2. Create a separate formula and place this on Group Footer:

    shared numbervar stot;
    shared numbervar gtot;
    gtot := gtot + stot;
    stot;

    3. Create a reset formula and place this on the Group Header:

    shared numbervar stot := 0;

    4. One last formula to show the Grand Total. Place this on the Report Footer:

    shared numbervar gtot;

    -Abhilash

    Add comment
    10|10000 characters needed characters exceeded

    • Thank you very much for this answer. Very helpful in better understanding the use of shared summary formulas and the placement for function. - Darek

  • avatar image
    Former Member
    May 25, 2017 at 02:57 AM

    Hi Mavis,

    This is likely to be due to the way Crystal Reports processes objects or better said CR processes some objects before others, so some things get ignored.

    Just to clarify: So you are passing a value from the sub-report back to the main report in the same section, correct? Now you want to sum the values in the main report, including the value that you are retrieving from the sub-report?

    What section is the sub-report in? Which section do you want the total and grand totals to be in?

    Thanks,
    Kevin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Kevin,

      That is what I did but the total value will always remind as the value of the last Invoice value.

      I place the sharevalue in both GF1 and PF all getting from the last invoice value.

      Thanks.

  • avatar image
    Former Member
    May 30, 2017 at 01:00 AM

    HI,

    Anyone can advise on the above. I tried the way Kevin advised but still having the same issue.

    Thanks!

    Add comment
    10|10000 characters needed characters exceeded