Skip to Content
0
Former Member
Mar 31, 2011 at 05:46 PM

This Field Cannot Be Summarized

301 Views

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.