Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

andyrebs
New Contributor

total in pivot

Hi,

as you can see in the below image, the total in the last column is calulculated by 161*114, not by the sum of 5.459+3.679.

How I can set partial sum as I want?

Many thanks

Immagine.JPG

Andrea

1 Solution

Accepted Solutions
MVP
MVP

Re: total in pivot

Hi

Assuming [Codice articolo] is the only dimension on the pivot table:

Sum(Aggr(Sum([cost]) * sum({$<Importo-={''}>} [Q.tà ord.]), [Codice articolo]))

You have typed a ) where there should be comma. If there are other dimensions, add them after [Codice articolo] as a comma separated list.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
4 Replies
MVP
MVP

Re: total in pivot

Hi

You will need to use an Aggr() expression for your table. It will look something like:

     =Sum(Aggr(  ... your current calculation here ... , Dim1, Dim2, Dim3, ...)

For example

     =Sum(Aggr(Sum(Amount * Factor), ClientID))

Insert your current expression in ... your current calculation here ... and the pivot table dimensions in Dim1, Dim2, etc.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
andyrebs
New Contributor

Re: total in pivot

Hi Jonathan,

thanks for your answer.

The expressions in the table are:

Q.tà: sum({$<Importo-={''}>} [Q.tà ord.])

Ultimo costo: sum([cost])

costo totale: =num(sum([cost])*sum({$<Importo-={''}>} [Q.tà ord.]))

If I set the last expression as you suggest

sum (aggr (sum([cost])*sum({$<Importo-={''}>} [Q.tà ord.]) ) [Codice articolo]))

it returns an error.

MVP
MVP

Re: total in pivot

Hi

Assuming [Codice articolo] is the only dimension on the pivot table:

Sum(Aggr(Sum([cost]) * sum({$<Importo-={''}>} [Q.tà ord.]), [Codice articolo]))

You have typed a ) where there should be comma. If there are other dimensions, add them after [Codice articolo] as a comma separated list.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
andyrebs
New Contributor

Re: total in pivot

Many thanks Jonahtan!

Community Browser