cancel
Showing results for 
Search instead for 
Did you mean: 

This Field Cannot Be Summarized

Former Member
0 Kudos

Using Crystal Reports XI

Ok, I have a report with three group levels. I've done the "Detail" level, now I'm working on "rolling up" the report so that I can view at a higher level. I'm probably not doing this the "right" way, but here's what I'm attempting. To view at the "Group 3" level, I Hide the Group 3 Header/Footer and add a detail row (Detail b). I also suppress Detail a. I put the values I need to see at this level in the Detail b line.

The first problem is that I end up with several duplicate lines. Just checking the "Supress if Duplicated" doesn't really work. What I have found works is placing the following code in the Detail b/Suppress code behind:

{?View} <> '1'
or 
(
    {MyTable.Group1Field} = Previous ({MyTable.Group1Field})
    and
    {MyTable.Group2Field} = Previous ({MyTable.Group2Field})
    and
    {MyTable.Group3Field} = Previous ({MyTable.Group3Field})
)

The problem is that I have to count the displayed rows and show that value in the Group 2 Header. I can't just count the rows because it will count both proper rows and duplicate rows. So, I add the following formula (named ProperRowCount) to the Detail b line (suppressed).

If
    {MyTable.Group1Field} = Previous ({MyTable.Group1Field})
    and
    {MyTable.Group2Field} = Previous ({MyTable.Group2Field})
    and
    {MyTable.Group3Field} = Previous ({MyTable.Group3Field})
Then
    0
Else 
    1

Finally, to get the "correct" row count, I sum ProperRowCount by Group3:

Sum({@ProperRowCount}, {MyTable.Group3Field}

At this point I get an error that the field ({@ProperRowCount} cannot be summarized.

Why can't I sum {@ProperRowCount}? Crystal recognizes it as a number.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi again

Crystal will not let you summerize formulas containing previous. I have seen several postings on this subject. Look for the previous threads for a solution.

Debi

Edited by: Debi Herbert on Mar 31, 2011 2:32 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

Apparently global variables are the only way this will work.

Thanks for your help.

Former Member
0 Kudos

the easiest way around this is to create a group by a unique id

then place the fields in the group

a group header returns the 1st value it hits from a unique record, so if its employee info, create the group on emp id

then use manual running totals to capture the correct values, - this will always be correct.

the summary wizard wont work correctly when values are duplicated,

MANUAL RUNNING TOTALS

RESET

The reset formula is placed in a group header report header to reset the summary to zero for each unique record it groups by.

whileprintingrecords;

Numbervar X := 0;

CALCULATION

The calculation is placed adjacent to the field or formula that is being calculated.

(if there are duplicate values; create a group on the field that is being calculated on. If there are not duplicate records, the detail section is used.

whileprintingrecords;

Numbervar X := x + ; ( or formula)

DISPLAY

The display is the sum of what is being calculated. This is placed in a group, page or report footer. (generally placed in the group footer of the group header where the reset is placed.)

whileprintingrecords;

Numbervar X;

X