Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
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
Not applicable

Re: Limit filter values

Hi

Ok i See

Try this

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

Bruno

6 Replies
brunobertels
Not applicable

Re: Limit filter values

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

Re: Limit filter values

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
Not applicable

Re: Limit filter values

Hi

Ok i See

Try this

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

Bruno

Not applicable

Re: Limit filter values

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
Not applicable

Re: Limit filter values

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

Re: Limit filter values

Thanks for the explenation