Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

"last 7 days" filter

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.

6 Replies
Anonymous
Not applicable
Author

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?

maxgro
MVP
MVP

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)))'

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

http://masterssummit.com

http://robwunderlich.com

aveeeeeee7en
Specialist III
Specialist III

hi

See this thread:

http://community.qlik.com/message/728621#728621

Regards

Av7eN

Not applicable
Author

what does it mean "select in field"?

Anonymous
Not applicable
Author

In  your  button  properties-->> Tab Actions-->> Add

you  will see the  next window

shet1.PNG

then  you   use the  expression,    what you  provides Massimo


regards!