Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
felcar2013
Partner - Creator III
Partner - Creator III

sum cummulated sales last 12 months

hi

i want to always get the sum of sales of the last 12 months from the current selection. I am getting only the sum(sales) for the current selection month-year, but not the cummulated value, like for example if i select Nov-2012, i want to get the sum(sales) for the period between, Nov-2012 and Nov-2011 (12 months)

i use this formula, but it is not working.do you have other ideas? i also used AddMonths() but i get the same.

thanks

=num(sum({$<[Period ID]={">=$(=max([Period ID])-12)<=$(=max([Period ID]))"}>} Sales),'#.##0')

1 Solution

Accepted Solutions
Not applicable

Try with this:

sum({< PeriodFilter=, [Period ID]={">=$(=max([Period ID])-12)<=$(=max([Period ID]))"}>} Sales)

Where PeriodFilter is the filter that use in your report.

Regars,

Ricardo

View solution in original post

6 Replies
srinivasa1
Creator II
Creator II

Use like as below

sum({<[Period ID]={'$(=Max([Period ID])-1)'}>}sales)

Not applicable

The problem with the expression, is the format of the dates. You should be very careful with format dates. What is the format for [Period ID]? YYYY-MMM, YYYYMM, etc?

felcar2013
Partner - Creator III
Partner - Creator III
Author

i have integers for the period ID, not date formats. I generated a column with the Period id table, exactly to avoid that problem. My numbers are from 1 to 65

felcar2013
Partner - Creator III
Partner - Creator III
Author

seems like i wrongly expanded the $ sign, now it is working

thanks

Not applicable

Try with this:

sum({< PeriodFilter=, [Period ID]={">=$(=max([Period ID])-12)<=$(=max([Period ID]))"}>} Sales)

Where PeriodFilter is the filter that use in your report.

Regars,

Ricardo

felcar2013
Partner - Creator III
Partner - Creator III
Author

thanks, this is correct