Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
andyrebs
Contributor III
Contributor III

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
jonathandienst
Partner - Champion III
Partner - Champion III

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

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

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
Contributor III
Contributor III
Author

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.

jonathandienst
Partner - Champion III
Partner - Champion III

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
Contributor III
Contributor III
Author

Many thanks Jonahtan!