Now I'm running on Nprinting project. And I got filter change than before, How set filter for 'rolling year', the scenario is : if today is Mar 2019, Nprinting must generate report from Jan 2018 - Feb 2019. and the scenario will able for next month.
Currently we used 2 filter, there are:
Year: =If(Month(Today())>1, Year(Today()), Year(AddYears(Today(), -1)))
But with these filters, NPrinting generated report only Feb 2019 , not from Jan 2018 - Feb 2019.
Does anyone have an idea? What should we replace in the previous filter?
Have a good day,Febri.
Yes, it will generate the reports for Feb-2019.
Year: =If(Month(Today())>1, Year(Today()), Year(AddYears(Today(), -1))) It will Return 2019 Year
Month: =Month(AddMonths(Date(Today()),-1)) it will return Feb Month
you have to change the Condition. in the NPrinting Filter i have no idea how we can change.
but in the report, you can use Set Analysis to achieve it.
The best way to approach this is by creating a flag in your Qlik datamodel.
I am not 100% sure what range do you want to do and what do you mean by rolling year. Maybe give us some scenarios....but to give you an idea how it can work i would refer directly to date field:
If(Date>=YearStart(Today()) and Date <MonthStart(Today()),1,0) as flag_Rolling_Current_Year, - this will flag all dates in your model starting from beginning of the year till end of last month
If(Date>=YearStart(Today(),-1) and Date <MonthStart(Today()),1,0) as flag_Rolling_CurrentNPrevious_Year, - this will flag all dates in your model starting from beginning of the last year till end of last month
then in NPrinitng you would just use 1 filter - flag you would create (so your filter would be like: flag_Rolling_Current_Year= numeric value is: 1
Advanced filtering is not yet available on Qlik NPrinting (February 2019) so, in my opinion, the best solution is the one suggested by Lech. This solution has also the advantage that formulas in the reload script are calculated one time during data reload and not every time a filter is applied to generate a report. This made report generation faster.
As general rule to create a OR condition (you want to select sales of today OR yesterday OR...) you have to insert multiple lines, one for each value, in the filter field like in the picture below.
Ruggero just shown you how "Or" condition is applied and it is will not be useful in your scenario.
His example would return Today, Yesterday,2 and 3 days back (4 days all together)
Check in QlikView if your formula works directly there, if it does please screenshot your filter in NPrinting and attach here (just like Ruggero did)
Did you use "numerical value is" = 1?
I mentioned here about traps with datatypes when using NPrinting filters:
I probably misunderstood your previous post. So if it is not working for you in QlikView script:
You need to make sure that your date is actually stored as date (not as a text) to ensure that formula i suggested works for you