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

Filter on above function

Hi everyone,

I'm trying to calculate a sum of past 6 values in a graph.

Consider this is my data:

LOAD * INLINE [

Year, Month, Value

2016,201601,20

2016,201602,14

2016,201603,15

2016,201604,17

2016,201605,23

2016,201606,18

2016,201607,10

2016,201608,34

2016,201609,29

2016,201610,17

2016,201611,19

2016,201612,24

2017,201701,28

2017,201702,19

2017,201703,20

2017,201704,15

2017,201705,18

2017,201706,28

2017,201707,21

];

And the calculation with the functions above and rangesum :

Rangesum(above(sum(Value),0,6))

  

Monthsum(Value)Rangesum(above(sum(Value),0,6))
2016012020
2016021434
2016031549
2016041766
2016052389
20160618107
2016071097
20160834117
20160929131
20161017131
20161119127
20161224133
20170128151
20170219136
20170320127
20170415125
20170518124
20170628128
20170721121

For 201707 the calculation is : 21+28+18+15+20+19 = 121.

My problem is i want to show in a line graph only the 2017 year, so i've changed my calculation by:

Rangesum(above(sum({<Year ={"2017"}>}Value),0,6))

But the filter on 2017 exclude my 2016 datas in the calculation so the firsts 6 months are wrong.

Do you have a solution to display only the 2017 year in the graph without filter the expression ?

Please find the qvd in attached.

Thanks

1 Solution

Accepted Solutions
krishnacbe
Partner - Specialist III
Partner - Specialist III

Try below Expression

if(Year='2017', Rangesum(above(sum(Value),0,6)))

View solution in original post

5 Replies
krishnacbe
Partner - Specialist III
Partner - Specialist III

Try below Expression

if(Year='2017', Rangesum(above(sum(Value),0,6)))

sunny_talwar

Try this

RangeSum(Above(Sum({<Year>}Value),0,6)) * Avg({<Year ={"2017"}>} 1)

Capture.PNG

Not applicable
Author

Thank you guys, both of your solutions are working on my real case.

I've spent 1 day to find a solution, you are the best.

Thanks again.

Not applicable
Author

Its working, thank you very much.

Not applicable
Author

Its working, thank you very much.