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

Sum of sales Expression

I have a pivot table with months as a dimension. My first expression is a simple =sum(Sales), that shows the total sales of each month.

I want to create another expression that shows the sales of the 3 previous months besides the sales each month. For example, on the month of July, my first expression would show the sales of July, while my second expression would show the sales of April, May and June. 

Thanks in advance for your help!

Labels (2)
4 Replies
Vegar
MVP
MVP

Its not straight forward to present data from another field value on a dimension value, eg June and May values on the July dimension.

One way to do this is to implement an as of calendar. Take a look at @hic  blog post on the topic. https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130 

Anil_Babu_Samineni

Perhaps this?

Dimension : Month

Expression - (1) 

Sum(Sales)

Expression - (2) 

Sum({<Month = {">=$(=AddMonths(Max(Month),-3))<=$(=Max(Month))"}>} Sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
hic
Former Employee
Former Employee

Try RangeSum(Above(Sum(Sales),1,3))

See more on https://community.qlik.com/t5/Qlik-Design-Blog/The-Above-Function/ba-p/1465357

HIC

Brett_Bleess
Former Employee
Former Employee

Rafael, did any of the posters comments help you get what you needed?  If so, please be sure to use the Accept as Solution button on the one(s) that helped to let others know what worked and to give credit to the posters.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.