Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Limit filter values

Dear experts,

I have a filter that is based on quarters.

periode-filters.PNG

The expression code is: QuarterName(reportingdate, 0).

"reportingdate" is a Qlik date.

But I want to limit the filters, I want only to see the current quarter, that the end-user is at when they open the qlik app, at time of writing this is "Jul-Sep 2016", -1, -2, -3.

So the end result will be this, notice that "Oct-Dev 2016" is gone in the image below:

periode-filters-limit.PNG

How can I achieve this? Couldn't find good examples via the search/google.

1 Solution

Accepted Solutions
brunobertels
Master
Master

Hi

Ok i See

Try this

if(reportingdate>=QuarterStart(Today(), -3) and reportingdate<=Today(), quartername(reportingdate),null())

Bruno

View solution in original post

6 Replies
brunobertels
Master
Master

Hi Jermaine,

Try this

expression to add in your filter object :

if(reportingdate<=today(),quartername(reportingdate),null())

Or in your script :

if(reportingdate<=today(),quartername(reportingdate),null()) as Quarter,

hope it helps

Not applicable
Author

This is really helpfull, thanks.

if (reportingdate <= Today(), QuarterName(reportingdate), null())

If I do that in my expression and I add more content to add more quarters, like "Jul-Sep 2015", I will see those too. I don't want to see them, I only want to see the first 4 quarters from today if they are available.

So I only want to see "Jul-sep 2016" ,  "Apr-Jun 2016", "Jan-Mar 2016", "Oct-Dec 2015", so only the first 4 quarters including "today".

periode-filters-today.PNG

brunobertels
Master
Master

Hi

Ok i See

Try this

if(reportingdate>=QuarterStart(Today(), -3) and reportingdate<=Today(), quartername(reportingdate),null())

Bruno

Not applicable
Author

Thanks for this answer, it works, one more question:

if (reportingdate >= QuarterStart(Today(), -3) AND reportingdate <= Today(), QuarterName(reportingdate), null())

Why the

null()

function, I mean that is the else branch of the if statement right? If I just remove it, it works fine too, but maybe I'm missing something else.

Beginner with Qlik scripting.

brunobertels
Master
Master

Hi

The null() functin is the second part of the if statement your wright. If statement in qlik accept to have only one branch. So with or without null () will give the same result.

Regards

Not applicable
Author

Thanks for the explenation