Crystal Report Sum of a Group Summary

2019-05-07 03:07发布

I have a report in which I'm trying to sum a summary on one group to another group. Ex:

   group 1: 75         <- sum of the maximums 
       group 2: 50     <- max of the group
           line 1: 50
           line 2: 40
           line 3: 10
       group 2: 25     <- max of the group
           line 1: 10
           line 2: 2
           line 3: 25

I've tried using a running total, but can't seem to get that right. I've also tried to put the maximum part into a formula, but Crystal still won't summarize it.

1条回答
Summer. ? 凉城
2楼-- · 2019-05-07 03:22

If you absolutely have to have the value in the Group1 Header then I think your only option will be a SQL Expression.

The Group1 Footer would be much easier. The gist is that you can simply keep track of the sum of the maxes with a variable.

//Place this formula in the Group1 Header
whileprintingrecords;
numbervar g1sum := 0;

//Place this formula in the Group2 Footer
whileprintingrecords;
numbervar g1sum;
g1sum := g1sum + maximum({table.value},{table.group2_field})

//Place this formula in the Group1 Footer
whileprintingrecords;
numbervar g1sum;
查看更多
登录 后发表回答