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: 
Anonymous
Not applicable

Last N month values

Hi All,

I am looking for last N months Avg values in the chart. I am using below expression

=AVG({<Date ={">=$(=Date(addmonths(Max('$(vyearmonth)'), -2), 'MMM-YYYY')) <=$(=Date(addmonths(Max('$(vyearmonth)'), -1),  'MMM-YYYY'))"} >} Sales)

which is not giving any values

My data looks like below

load * Inline

[

Date,Sales

01/05/2016,20

02/05/2016,10

03/05/2016,20

04/05/2016,20

05/05/2016,30

.........];

vyearmonth

=MONTHNAME(date#(Date,'DD/MM/YYYY'))

Kindly let me know what and where I am missing

Labels (1)
21 Replies
Anonymous
Not applicable
Author

Hi,

All I need is I need to show last 2 or 3 Months data in the rolling format. Kindly help me on this.

othniel2014
Contributor III
Contributor III

Could you give me an example of sales of 3 months and the results you expect?

I used this, but I'm Hispanic and I do not understand what you mean by "rolling"

AVG per line:

avg(Sales)

Test1:

RangeAvg( above( AVG(Sales),0,3) )

Test2:

avg( aggr( rangeavg( above( avg(Sales),0,3) ),Month_))

Test3:

avg( aggr( rangeavg( above( avg( {$<Month_>}  Sales),0,3) ),Month_))

PDT: Please give me 3 values concerning 3 months and the results you expect !