# QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

## Arithmetic Operation between two diff Aggr and changing the partial sum

Hi All,

I have the following table

A10100
 1.66667
B20200
 6.66667
C30300
 15
Total
 20
 600
20( Expected:
 23.3333
)

Column 2 : is a SUM(AGGR(SUM [.....])))

Column 3 : is a Average of some value AVG(AGGR(AVG[...]))

Expression in Header 4 : (Column 2 * Column 3)/(Total of Column 3 )

So my problem is in Header 4 : the total basically shows me Column 2 * Column 3 /Column 3

but what i was is the sum of the values in Header 4

Can anyone help me out here?

Thanks,

Jacob

1 Solution

Accepted Solutions

## Re: Re: Re: Arithmetic Operation between two diff Aggr and changing the partial sum

Jacob,

Please see the attached.  It should give you what you're looking for.

sum(aggr(sum(aggr(avg(Sales)*Sum(Target),Country))/sum(aggr(Sum(TOTAL Target),Country)),Country))

8 Replies

## Re: Arithmetic Operation between two diff Aggr and changing the partial sum

If you're using a straight table, for Expression 4, change the Total Mode to Sum of Rows instead of Expression Total:

Not applicable

## Re: Arithmetic Operation between two diff Aggr and changing the partial sum

Hi Nicole , i am using a pivot table and using partial sum. and the total in the partial sum is messed up

## Re: Arithmetic Operation between two diff Aggr and changing the partial sum

I believe Partial Sums always use expression totals, so you'll either need to mess around with your expression until it gives you the value you want (by summing the rows), or use a straight table instead.

MVP

## Re: Arithmetic Operation between two diff Aggr and changing the partial sum

Hi

You will need something like this (assuming Column1 is the single dimension in the table):

Sum(Aggr(

Sum(Aggr(Sum...)) * Avg(Aggr(Avg...)) / Sum(TOTAL Aggr(Avg(Aggr(...)))),

Column1))

The bold sections are your column2 and column3 expressions. All the chart dimensions need to be included in the dimensions of all 5 of  the aggr() expressions.

HTH

Jonathan

Not applicable

## Re: Re: Arithmetic Operation between two diff Aggr and changing the partial sum

Jonathan, i have attached an sample, it doesnt work. Sorry but do you mind helping me out here?

Highlighted
Not applicable

## Re: Arithmetic Operation between two diff Aggr and changing the partial sum

Hey Jacob,

Why should the total of column4 be 23.3333.

per your explanation it should be (20 * 600)  / 600 = 1200/600 = 20  isn't it?

Thanks

AJ

## Re: Re: Re: Arithmetic Operation between two diff Aggr and changing the partial sum

Jacob,

Please see the attached.  It should give you what you're looking for.

sum(aggr(sum(aggr(avg(Sales)*Sum(Target),Country))/sum(aggr(Sum(TOTAL Target),Country)),Country))

Not applicable

## Re: Re: Arithmetic Operation between two diff Aggr and changing the partial sum

Thanks a lot nicole