Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Partial sum in pivot table

Hello,

sorry if i overlooked.

i have 2 dimensions (product and canal)

I would like to divide :

the quantity for each product and each canal : easy double aggr :  sum(aggr(Quantity,Canal,Product)) 

by

all the quantity sold on this canal. I thought only one aggr : sum(aggr(Quantity,Canal)) (the equivalent of the partial total) but it doesn't work properly. sometimes 0 is displayed sometimes it's an incomprehensible number...

How can i get this "subtotal" ? am I in a wrong way ? maybe use the function only ?

Canal123
Product


A1 /22 /51 /1
B0 /23 /50 /1
C1 /20 /50 /1
subtotal251

Ce message a été modifié par: tangred83

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

You should not use Aggr() here. Instead you should use the "total" qualifier inside the Aggregation function. The partial sums of the column (2, 5 and 1) can be obtained through

     Sum(total <Canal> Number)

Image1.png

See more on http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-u...

HIC

View solution in original post

5 Replies
MayilVahanan

HI

For subtotal,try like this

=If(isnull(rowno()) or rowno() = 0, your subtotal expression, your expression)

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
hic
Former Employee
Former Employee

You should not use Aggr() here. Instead you should use the "total" qualifier inside the Aggregation function. The partial sums of the column (2, 5 and 1) can be obtained through

     Sum(total <Canal> Number)

Image1.png

See more on http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-u...

HIC

Not applicable
Author

Thx a lot !

Not applicable
Author

Is is possible to the same thing over two dimensions?

Sum(total <dimension1> <dimension2> Number)

This is not accepted. Is there an alternative?

hic
Former Employee
Former Employee

Sum(total <dimension1,dimension2> Number)

HIC