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

Rolling 12 month chart

Hi,

I can use the forum’s help with a rolling 12 month chart I am trying to create.

I wish to generate a line chart showing the sum of profit for the rolling 12 month for multiple countries on the same line chart.

After reading through the forum I attempted to do the following:

sum( aggr( rangesum( above( sum( {$<Time>}  Profit),0,12) ),Time,Country))

But the results I’m getting have nothing to do with what I was hoping for.

When I use the following expression:

sum( aggr( rangesum( above( sum( {$<Time>}  Profit),0,12) ),Time))

I get the right results only when I chose one of the countries. When more than one country is selected I get the sum of the profit for the countries on one line.

I’m not sure what I’m doing wrong here. Unfortunately I don’t have access to the script.

Any help will be appreciated.

Once the chart get the right data I would also like to present only data for months that have actual sum of 12 month (i.e. not show the first 11 months as data point). But this is more of a “nice to have”

I’m attaching mock qvw file to help explain what I’m try to do.

Thanks in advance,

S

I tried looking here:

Calculating rolling n-period totals, averages or other aggregations

and here:

Accumulative Sums

But couldn't figure it out.

1 Solution

Accepted Solutions
Not applicable
Author

Hi try this expression:


sum( aggr( rangesum( above( sum( {$<Time>}  Profit),0,12) ),Country,Time))



View solution in original post

3 Replies
Not applicable
Author

Hi try this expression:


sum( aggr( rangesum( above( sum( {$<Time>}  Profit),0,12) ),Country,Time))



Not applicable
Author

Thanks. It works

Not applicable
Author

ur welcome! please mark the reply as correct and close the thread since the question is solved. thanks!