# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor II

## aggr with average

Hi i am using aggr function to derive a sum but i need to slice the data into quarter  where the subtotal should be average of 3 month attched hereiwth  is the data for the same

Thanking You

Vinayagam

1 Solution

Accepted Solutions
MVP

## Re: aggr with average

Ok, you want averages for horizontal total and sum for vertical total of AVGPO, right?

Then you need to use Dimensionality() and SecondaryDimensionality() to switch between different expressions on total cells.

See attached AVGPO2 expression.

8 Replies
MVP

## Re: aggr with average

Maybe like attached?

New Contributor II

## Re: aggr with average

Thanks Sir

But if u c the total below the centre its is giving avg wherein i require the sum of average

Thanking You

Vinayagam

MVP

## Re: aggr with average

Ok, you want averages for horizontal total and sum for vertical total of AVGPO, right?

Then you need to use Dimensionality() and SecondaryDimensionality() to switch between different expressions on total cells.

See attached AVGPO2 expression.

Honored Contributor II

## Re: aggr with average

Hi swuehl

Good one.

Honored Contributor II

## Re: aggr with average

swuehl

Has given in PO TEST_2.qvw in AVGPO2.

Which value do you want to get?

New Contributor II

## Re: aggr with average

Exactly sir  thank u

New Contributor II

## Re: aggr with average

sir in the same line could we get the sum of the subtotal VERTICAL total of horizontal avg

MVP

## Re: aggr with average

If I've understood correctly, just change the order of dimensionality checks:

=if( SecondaryDimensionality()=0,

avg( aggr( SUM(PO)/ COUNT(DISTINCT(Date)), Centre, MONTHNAME)),

if( Dimensionality()=0,

sum( aggr( SUM(PO)/ COUNT(DISTINCT(Date)), Centre, MONTHNAME)),

SUM(PO)/ COUNT(DISTINCT(Date))

))