Showing posts with label averages. Show all posts
Showing posts with label averages. Show all posts

Friday, March 9, 2012

Matrix and column and row based averages without using avg()

A

A

A

A

B

B

Avg.

Name

1

2

3

4

1

2

xxxxxxxxxxx

12/16

90

100

85

10/8

100

--

xxxxxxxxxxx

20/16

93

5/8

100

--

xxxxxxxxxxx

16/16

89

90

16/8

95

--

Avg.

--

--

--

--

--

--

--

Greetings,

I have a matrix that looks similar to the table above with two row groups and one column group. Does anyone know a way to manually do column and row based averaging without using the avg() function -as the data is not numerical?

Thanks

Hi,

Please try

1. converting the non numerical to numerical by using cdbl. and then use avg.

2. if it is not possible to use cdbl, then use sum in scope of that particular group and dicide by rownumber of that group.

say : sum(abcd,"Group1")/rownumber(group1)

|||

Hey, thanks for the reply. Not all fields are numeric in this case. I just need to avg. the numeric values. A quick test revealed that the report is generated left to right top to bottom. It seems that I will need to keep a tally of the total in code. The problem is that point where the variables should reset is not always the correct place. For example -

This only handles row based not column based havent even started that.

private iRowCount as Integer

private iRowSum as Double

public Function DisplayDataCell(Score as String, InRowGroup as Boolean, InColumnGroup as boolean, IsNumber as boolean)

dim Result as String

dim Avgerage as Double

Result=""

if (not IsNumber) then

Result=Score

else if (InRowGroup and InColumnGroup) then

iRowCount=iRowCount+1

iRowSum=iRowSum+CDbl(Score)

Result=Score

else if not(InRowGroup)then

Average=(iRowSum / iRowCount)

iRowSum=0

iRowCount=0

Result=CStr(Avegerage)

end if

Return Result

end function

The problem is the point where the values are being reset is not always working out for me. I know I am doing something wrong. When you say use rowcount and columncount where should I use these values to return the avg?

not InRowGroup and not InColumnGroup.

Thanks,

Matrix and Averages

My Matrix has the following structure
Product Jan Feb Mar Total
--
Prroduct1 2 4 1 6
How would I add an "average column"
Product Jan Feb Mar Total Avg
--
Prroduct1 2 4 1 6 2Okay, I solved my % Total problem.
In the data region, I split the cell into two, one is the original data, the
other is the % of the left cell to the scope. Then the Total and %Total
appear side by side if you do subtotal to the group. After that, hide the
%Total column using inscope function if it is in the scope.
But I am very interested in knowing if it is possible to do average though.
"Frank RS" wrote:
> I have the similar situation-- to add a %Total after the Total filed.
> It looks impossible because Total column is pretty much the last column in a
> matrix.
> Microsoft gurus, please help on this problem.
> At least let us know if it is doablt.
> Thanks in advance!
> Frank
> "SAcanuck" wrote:
> > My Matrix has the following structure
> > Product Jan Feb Mar Total
> > --
> > Prroduct1 2 4 1 6
> >
> > How would I add an "average column"
> >
> > Product Jan Feb Mar Total Avg
> > --
> > Prroduct1 2 4 1 6 2
> >|||I guess I got the answer to this question too.
Just modify the expression to change the sum function into average function.
I will post if I got time to play with it.
"Frank RS" wrote:
> Okay, I solved my % Total problem.
> In the data region, I split the cell into two, one is the original data, the
> other is the % of the left cell to the scope. Then the Total and %Total
> appear side by side if you do subtotal to the group. After that, hide the
> %Total column using inscope function if it is in the scope.
> But I am very interested in knowing if it is possible to do average though.
> "Frank RS" wrote:
> > I have the similar situation-- to add a %Total after the Total filed.
> > It looks impossible because Total column is pretty much the last column in a
> > matrix.
> > Microsoft gurus, please help on this problem.
> > At least let us know if it is doablt.
> > Thanks in advance!
> > Frank
> >
> > "SAcanuck" wrote:
> >
> > > My Matrix has the following structure
> > > Product Jan Feb Mar Total
> > > --
> > > Prroduct1 2 4 1 6
> > >
> > > How would I add an "average column"
> > >
> > > Product Jan Feb Mar Total Avg
> > > --
> > > Prroduct1 2 4 1 6 2
> > >