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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Selis
Contributor III
Contributor III

Data calculation

Hi,

I have a simple pivot table which summarize the sum of sales for each customer grouped by Quarter and Year (See attached file).

I want to change the data so instead of the sum of sales for each quarter it will show in each quarter the sum of sales for the previous 5 quarters .

For example, in the attached table - the date for Q4/2025 shows 20 and I want it to show 270 which is the sum of the previous 5 quarters.

Thanks

Labels (2)
3 Replies
robert_mika
MVP
MVP

Try RangeSum(Above(Sum(Sales), 0, 5))

Selis
Contributor III
Contributor III
Author

Hi Robert,

This solution will not work since the Pivot table can show filtered Quarters and not A sequence of consecutive quarters.

I need it to calculate the sum of previous 5 quarters from the data itself.

The source of the data shown in the pivot is from a simple table which contains the following:

Customer name, QuarterID sequence, some of sales

 

Thanks

Shlomo 

marcus_sommer
MVP
MVP

You may need an extension to the above provided interrecord-feature by dividing the task into two steps. The first will be to wrap the interrecord-logic with an aggr() construct which ignores these selection and ensuring that all needed values are available and the complete calculation could be done. The second step is a boolean condition against it which respects the selections and the object-dimensionalities to filter the first data-set to the wanted subset.

Such approach could become quite complex. Simpler might be therefore to transfer the essential matching into the data-modle by using a logic like:

The As-Of Table - Qlik Community - 1466130