Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to create a filter for show only 5 year data instead of 20 year data ?

Hi All

My QS Doc have last 20 year data.

I like to have a button to filter only analyse last 5 year data or 20 year data.

May i know how can i use it , instead of using 2 seperate Doc.

Paul

1 Solution

Accepted Solutions
ogster1974
Partner - Master II
Partner - Master II

If its taking along time to do a simple filter selection why don't you create a bookmark of the predefined 5 year filter, call it last 5 years and save your app with the filter applied that way when you open the document its always filtered on the last 5 years.

Regards

Andy

View solution in original post

7 Replies
sunny_talwar

May be use this as action -> Select in Field

Search String: ='>=' & Max({1}Year) - 4 & '<=' & Max({1} Year)

sunny_talwar

Just realized this is a Qlik Sense discussion. I am not very familiar with Qlik Sense Button actions, so not sure if what I prescribed will work or not

paulyeo11
Master
Master
Author

Hi Sir

QS have filter panel , but need to manually select year one by one very slow.

Paul

Sent from my iPhone

Not applicable

Hello,

I am not sure if I understood your issue, but you can try the following code:

if(Year>= START_YEAR and Year <= END_YEAR, Year)

Replace START_YEAR and END_YEAR as you need.

If the years are non consecutive you can try:

if(match(Year, 2000, 2005, 2010,2011), Year)

I hope it helps!

ogster1974
Partner - Master II
Partner - Master II

If its taking along time to do a simple filter selection why don't you create a bookmark of the predefined 5 year filter, call it last 5 years and save your app with the filter applied that way when you open the document its always filtered on the last 5 years.

Regards

Andy

marcus_sommer

I would rather tend to create additionally selection-fields within the script maybe with something like this:

ceil((year(today() - year) / 5) as FiveYearsPeriod

or

class((year(today() - year), 5)

or other kind of flagging the data.

- Marcus

paulyeo11
Master
Master
Author

Hi All

Thank you very much for all of you sharing  , i will try out every approach.

Paul