Skip to Content
0
Former Member
Apr 11, 2016 at 01:12 PM

Crosstab Grid - Average Count

42 Views

Hi guys, i need some help in Crystal for creating an average of a calculated column in a crosstab.

For better understanding alle the rows are visible, in the columns you can see 2 fields, the coloured one is the value of the db the other one is the

calculated value, in this case if there is a 11 the value should be 0

Formular for the rows:

if GridValueAt(CurrentRowIndex, CurrentColumnIndex, CurrentSummaryIndex-1) = 11 then
0
else
(GridValueAt(CurrentRowIndex, CurrentColumnIndex, CurrentSummaryIndex-1))

Now i want to summarize this columns to have the sum of all.

Field: Average_Right

local numbervar i;
local numbervar total;
local numbervar avg;
while i <> currentrowindex do
(
    total := total + tonumber(gridvalueat(i,CurrentColumnIndex,CurrentSummaryIndex));
    i := i + 1;
);
total;

What i need is a average of this total and therefore i need a count of the values which are not like 11.

In the Field "Gesamtdurchschnitt" you can see the average result of CR, what is not correct cause it includes the rows which are 11.

How to include this case into the summarize formular?

Thanks for any hint and help

THX and BR

Rudi

Attachments

q1.PNG (10.2 kB)