Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear experts,
I have a filter that is based on quarters.
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:
How can I achieve this? Couldn't find good examples via the search/google.
Hi
Ok i See
Try this
if(reportingdate>=QuarterStart(Today(), -3) and reportingdate<=Today(), quartername(reportingdate),null())
Bruno
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
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".
Hi
Ok i See
Try this
if(reportingdate>=QuarterStart(Today(), -3) and reportingdate<=Today(), quartername(reportingdate),null())
Bruno
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.
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
Thanks for the explenation