Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Joe_
Contributor II
Contributor II

Show moving average values in a line chart

Hi guys. I been googling alot without success.

I would like to create some moving average measures for sales for the last 6, 12 months in a line chart. 

At the moment I am just displaying the last choosen amount of months with 

Date = {">=$(=addmonths(monthstart(today()), -6))"}, 

What I would like to do is take the sum of the sales for the last 6 months and divide it by 6 to distribute the sales evenly throughout a 6 month period to see a trend

Any help is appreciated

BR 

Joe

 

Labels (5)
2 Solutions

Accepted Solutions
ajaykakkar93
Specialist III
Specialist III

hi,

data:
load MonthName(Orderdate) as MonthYear,ID,sales;
load * Inline [
ID,Orderdate,sales
A123,01/01/2022,200
B123,01/02/2022,100
C568,01/03/2022,150
C568,01/04/2022,180
C568,01/05/2022,50
C568,01/06/2022,90
C568,01/07/2022,950
C568,01/08/2022,70
C568,01/09/2022,30
C568,01/10/2022,50
C568,01/11/2022,500
C568,01/12/2022,200
];

 

in chart i am using a measure 

rangeavg(above(sum(sales),0,6))

can refer this link :
https://community.qlik.com/t5/QlikView-App-Dev/Moving-Averages-in-Charts/td-p/373666

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

View solution in original post

Joe_
Contributor II
Contributor II
Author

Thanks! 

I used 

rangeavg(above(sum({<Date = {">=$(=addmonths(monthstart(today()), -6))"} >}(Sales),0,6))

View solution in original post

2 Replies
ajaykakkar93
Specialist III
Specialist III

hi,

data:
load MonthName(Orderdate) as MonthYear,ID,sales;
load * Inline [
ID,Orderdate,sales
A123,01/01/2022,200
B123,01/02/2022,100
C568,01/03/2022,150
C568,01/04/2022,180
C568,01/05/2022,50
C568,01/06/2022,90
C568,01/07/2022,950
C568,01/08/2022,70
C568,01/09/2022,30
C568,01/10/2022,50
C568,01/11/2022,500
C568,01/12/2022,200
];

 

in chart i am using a measure 

rangeavg(above(sum(sales),0,6))

can refer this link :
https://community.qlik.com/t5/QlikView-App-Dev/Moving-Averages-in-Charts/td-p/373666

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

Joe_
Contributor II
Contributor II
Author

Thanks! 

I used 

rangeavg(above(sum({<Date = {">=$(=addmonths(monthstart(today()), -6))"} >}(Sales),0,6))