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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Chart last 6 months average

Hi guys, I need your help,

I have this chart below, with some values in bars and lines, but these lines are not right.

The lines should shows the average of last 6 months in each month.

In other words, the values of the each month in the lines must be the average of the last 6 values on the bars, for example the line value in FEB/15 should be 47,4 that is from average of (39.2, 35.3, 33.0, 55.6, 37.5, 84.1) (blue bars) and the line value of JAN/15 should be 50 from (35.3, 33.0, 55.6, 37.5, 84.1, 54.3)

I need create an expression in this chart to do that, below its a table with the correct values that should be in the chart.

Date

Average (FH)Average (FC)FH - L6M Moving AverageFC - L6M Moving Average
MAR/141,821,82
APR/1441,32121,612
MAY/1447,92130,415
JUN/1410,8525,512
JUL/14143,98449,227
AUG/1454,35550,031
SEP/1484,15563,740
OCT/1437,52563,141
NOV/1455,64864,445
DEC/1433,02268,148
JAN/1535,33050,039
FEB/1539,22747,434

Thanks guys.

1 Solution

Accepted Solutions
Not applicable
Author

Hi Giovani,

Please use the below expression to get the desired value.

Last 6 month moving average for FH

=rangeavg(Above(sum(FH),0,6))

Last 6 month moving average for FC

=rangeavg(Above(sum(FC),0,6))

Thanks,

Sajeevan

View solution in original post

6 Replies
Not applicable
Author

Hi,

You can try below expression in dimentions.

=if(Date>='SEP/14',Date)

Not applicable
Author

Doesnt work, 😕

Its a moving average, the value in feb/15 must be the average of the bar values from sep/14 to feb/15

Not applicable
Author

Hi Giovani,

Please use the below expression to get the desired value.

Last 6 month moving average for FH

=rangeavg(Above(sum(FH),0,6))

Last 6 month moving average for FC

=rangeavg(Above(sum(FC),0,6))

Thanks,

Sajeevan

Not applicable
Author

Hi,

You can do like this image.

Untitled.png

Not applicable
Author

HI Giovani,

try for below steps:

this is for last 6 months

Avg({<Date={'>=$(=max(Date)-5)<=$(=max(Date))'}>}FH)


Avg({<Date={'>=$(=max(Date)-5)<=$(=max(Date))'}>}FC)

Not applicable
Author

Hi Sajeevan,

I just changed to avg instead of sum and work beautifully. =rangeavg(Above(avg(FC),0,6))

Thank you so much Sajeevan, you rule dude!