Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
olivierrobin
Specialist III
Specialist III

cumulative total

hello,

i have a pivot table in which i want to calculate a cumulative total.

there are two dimensions : group and product

there are two columns : qty, whiwh is a quantity, and rank whiwh is the rank.

I want to compute the cumulative total of qty.

in the example given, there are 3 totalspivot.png

1st value =  492128

2nd = 213630

3rd = 460939

the need is to have

1st = 492128

2nd = 492128+213630

3rd = 492128+213630+460939

as read in the community, i tried the above fucntion, bur it seems to work only at the detail level, not with dimensions

qty.png

rank.png

10 Replies
Gysbert_Wassenaar

Try this expression:

if(Dimensionality()=1, sum(aggr(rangesum(above( sum(total <Groupe> QTECDE),0,RowNo())),Groupe)), sum(QTECDE))


talk is cheap, supply exceeds demand
amayuresh
Creator III
Creator III

Thank you Gysbert below works

if(Dimensionality()=1, sum(aggr(rangesum(above( sum(total <Group> QTECDE),0,RowNo())),Group)), sum(QTECDE))

Please see my example below

my expression is

Sales=sum(SalesAmount)

Cummulatie Sale=

if(Dimensionality()=1, sum(aggr(rangesum(above(sum(total <Order_Year> SalesAmount),0,RowNo())),Order_Year)), sum(SalesAmount))

b.PNG

olivierrobin
Specialist III
Specialist III
Author

i already tried something like that.

with the code, the result is shown below.

the qtys seems to be multiplied by 3 for the 1st ctageory, by 2 for the 2ns, and by a lot for the 3rd

2016-03-10_08h32_55.png

Gysbert_Wassenaar

Post a small qlikview document that demonstrates the problem.


talk is cheap, supply exceeds demand
olivierrobin
Specialist III
Specialist III
Author

i forgot to explain that my 2 dimensions are computed if this way

dim 1.pngdim 2.png

so i can't use total <Groupe> in the formula

amayuresh
Creator III
Creator III

What is your expression ?

Are you doing aggregation and subtotaling on Group dimension in expression like

if(Dimensionality()=1, sum(aggr(rangesum(above( sum(total <Group> QTECDE),0,RowNo())),Group)), sum(QTECDE)) ?

olivierrobin
Specialist III
Specialist III
Author

i tried

if(Dimensionality()=1, sum(aggr(rangesum(above( sum(total <Groupe> QTECDE),0,RowNo())),Groupe)), sum(QTECDE))


but it doesn't work as Groupe is a computed dimension (i think so)

did you see the application i posted ? (if not, please tell me the correct way to post it )

Gysbert_Wassenaar

Then what you want cannot be done afaik. At least not with doing the calculations in the script and creating the necessary fields there.


talk is cheap, supply exceeds demand
olivierrobin
Specialist III
Specialist III
Author

here is the application