Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi There,
I have a sales report that shows orders. But I only want to see orders with an order date within 7 days, meaning Today-7<Order Date<=Today. How do I set up a NP filter for this? I know I can make a selection in QVW file, make a bookmark for it and use the bookmark as a filter in NP but are there any other options to achieve this?
Hi, Agnes,
A better way to do this is to add a new field in your .qvw files like below, that is what I always so if need use date range filter in nprinitng:
LOAD
...
IF (num([Order Date])>=today()-7, "Last 7 days", "Older than last 7 days") as OrderDateRang,
...
Because in this way, you can also easier to use the filter in .qvw file, and you can also control to add more "OrderDateRange", like last 30 days or others.
Then you can use the filter OrderDateRange = 'Last 7 days' in Nprinitng.
If you want to directly use the last 7 days in filter in Nprinting, then you need all the value of the dates of last 7 days:
Date(today()-7, "YYYY-MM-DD")
Date(today()-6, "YYYY-MM-DD")
Date(today()-5, "YYYY-MM-DD")
...
Date(today()-1, "YYYY-MM-DD")
And then pls also notice about the date format, which must be the same as in your dash.
Zhihong
You can create filters in Nprinting and then associate it with a report, looking for information about dynamic filters, here there is documentation about that, https://help.qlik.com/en-US/nprinting/17.2/Content/FiltersCycles/StaticDynamicFilters/Static-dynamic...
You can use Today()-7.
Hi, Agnes,
A better way to do this is to add a new field in your .qvw files like below, that is what I always so if need use date range filter in nprinitng:
LOAD
...
IF (num([Order Date])>=today()-7, "Last 7 days", "Older than last 7 days") as OrderDateRang,
...
Because in this way, you can also easier to use the filter in .qvw file, and you can also control to add more "OrderDateRange", like last 30 days or others.
Then you can use the filter OrderDateRange = 'Last 7 days' in Nprinitng.
If you want to directly use the last 7 days in filter in Nprinting, then you need all the value of the dates of last 7 days:
Date(today()-7, "YYYY-MM-DD")
Date(today()-6, "YYYY-MM-DD")
Date(today()-5, "YYYY-MM-DD")
...
Date(today()-1, "YYYY-MM-DD")
And then pls also notice about the date format, which must be the same as in your dash.
Zhihong
Thanks, does it mean I need to set up 7 filters for this? =Today()-1, =Today()-2, ....It is not very flexible I guess.
Thanks for your answer Zhihong! I will definitely try it later and let you know how it goes!
Hi Zhihong, it works! Thanks a lot!
Yes, it must work, as I do use it many times.
And one more comment, if you do use the 2nd method, add all the expression values (like the Date(today()-5, "YYYY-MM-DD") ) in 1 filters, sometimes the filter dose not work for some reason, I do not why yet, and then you try to re-create the filter, then it should work finally.
Zhihong
Hope you figure this question out by my answer below, you only need 1 filter, but add multiple value, the dates, that you required
Zhihong