Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tobiasaechter
Contributor III

cumulative line chart - rangesum

Hi,

I am working in the QlikCloud.

I have a specified dataset with 20 quarters and sales volume. I would like to show a line chart where I provide for every quarter the cumulated sum of the last four quarters.

My dimension is: FQ and my expression is: rangesum(above(TOTAL Sales,0,4))

This works fine, but now I want to select only the last 5 quarters (15-20) and still see meaningful data in the line chart. unfortunately what happens is that if selecting those last 5 quarters, the chart does not show correct values anymore. Instead, in FQ15 I can see only the sales value for this specific quarter and not the sum of 12+13+14+15 anymore, like I would expect. Same for FQ16 & 17. From FQ18 on it is fine again.

please see attached example.

Can anyone please explain me what I am missing here?
I have created a similar chart in QlikView in the past and there it worked fine with the selections.

Labels (1)
1 Solution

Accepted Solutions
Dataintellinalytics

Please try this,
Aggr(Rangesum({<FQ=>}Above(TOTAL Sales,0,4)),FQ)

https://youtu.be/sac2z4xyz70

View solution in original post

3 Replies
Dataintellinalytics

Please try this,
Aggr(Rangesum({<FQ=>}Above(TOTAL Sales,0,4)),FQ)

https://youtu.be/sac2z4xyz70

koustubh
Contributor II

one solution is to add an additional column that stores the record of the last 5 quarters (check below query) and then using it in line chart 
 
Temp:
NoConcatenate
Load FQ,
Sales,
    Sales+peek(Sales)+Peek(Sales,-2)+peek(Sales,-3) as sales_sum
Resident Inline
Order by FQ;
 
Drop Table Inline;

 

koustubh
Contributor II

Hi Team Dataintellinalytics,

 

I have observed that it works equivalent to {1} identifier. 

Also, the TOTAL keyword does not add up for anything
(I removed the TOTAL keyword and it works the same)

Hence the below solution works the same -

Aggr(Rangesum({1}Above(Sales,0,4)),FQ)