Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
i would like to create a button that filters the data on the last seven days, another button for filtering on yesterday and another for today.
how can it be done?
thanks.
do you have a calendar table already in your data model? if not, create one - there are plenty of examples on a forum.
Then in that table, you can create fields/flags - to flag dates for the last 7 days, last month etc.
IS LAST 7 DAYS with two values dual(1,'Yes') or dual(0, 'No'))
IS LAST MONTH
I like to use dual types so you can use these fields in calculations but they still have user friendly descriptions
Then you can put listboxes on your sheet to limit data by these fields. So upside of this method is that your do not have to rewirte expressions or use complex set anaylisys expressions. So if you have a measure like SUM(Sales) and user selects Yes in IS LAST 7 DAYS listbox, your measure will be calculated only for the last 7 days.
OR you can use these flags in set analysis expressions, this is a good post
Calendar with flags making set analysis so very simple
Calculating rolling n-period totals, averages or other aggregations
But a button like you asked for will be a bit more difficult to implement.
Does it make sense?
add the action
7 days
select in field
your date field
='>=$(=(Date(Today()-7)))<=$(=(Date(Today()-0)))'
yestarday
select in field
your date field
='>=$(=(Date(Today()-1)))<=$(=(Date(Today()-1)))'
I like to assign temporal values like "last week", "last month" in the script. See this example for a method.
Qlikview Cookbook: Date Grouping http://qlikviewcookbook.com/recipes/download-info/date-grouping/
-Rob
what does it mean "select in field"?
In your button properties-->> Tab Actions-->> Add
you will see the next window
then you use the expression, what you provides Massimo
regards!