Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Button to Select Date Range

I have a date/timestamp field (add_date) with values such as:

10/13/2010 1:07:42 PM

11/19/2010 7:24:11 AM

11/29/2010 2:40:06 PM

1/3/2011 4:01:28 AM

2/14/2011 9:54:12 PM

2/16/2011 7:57:35 PM

and so on.

I'm trying to implement buttons that select all dates in the field that lay within these ranges: past week, past 13 weeks. I'm pretty sure that I need the "Select from Field" action but no clue as to what the search criteria needs to be.

6 Replies
Not applicable

Re: Button to Select Date Range

Hi,

Please see file attached for example.

Regards

R

Not applicable

Re: Button to Select Date Range

Is there no other way besides a master calendar approach?

Not applicable

Re: Button to Select Date Range

Hi,

There is no need for a master calander, i only have it in the test file as i did not have enough data in the inline table.

Regards

Rahul Lakhina

Not applicable

Re: Button to Select Date Range

Hi,

There is no need for a master calander, i only have it in the test file as i did not have enough data in the inline table.

Regards

Rahul Lakhina

Not applicable

Re: Button to Select Date Range

Even with that explanation, I'm not sure how that button is supposed to affect my date/timestamp field "add_date" I indicated above. To reiterate, I need the buttons to select that range in the "add_date" field. I'm trying to avoid master calendars and don't want to require users to enter in the present date to calculate.

I tried one of those buttons with those "Set Variable" actions, but they didn't change any selections.

Also, Rahul, to avoid double posts just disregard the error message you get when posting comments on this site. The mental wizards who designed this site thought flash would be a good language to use =)

Re: Button to Select Date Range

I have attached a working example.

In case you can't view it, I will explain what I did.

In my load script, I have:

Dates:

LOAD * INLINE [

add_date

10/13/2010 1:07:42 PM

11/19/2010 7:24:11 AM

11/29/2010 2:40:06 PM

1/3/2011 4:01:28 AM

2/14/2011 9:54:12 PM

2/16/2011 7:57:35 PM

9/3/2012 8:46:25 AM

7/25/2012 1:34:52 PM

9/2/2012 3:45:25 PM

]

On the "Past Week" button I have:

Action > Select in Field

Field is

     add_date

Search String is

     =if(count({1<add_date = {'>=$(=today()-7)'}>}add_date) > 1,

     '(' & concat({<add_date = {'>=$(=today()-7)'}>}Replace(add_date, ' ', '?'), '|')& ')',

     only({<add_date = {'>=$(=today()-7)'}>}add_date))

Capture.PNG

On the "Past 13 Weeks" button I have the same thing except Search String is (13 weeks = 91 days)

     =if(count({1<add_date = {'>=$(=today()-91)'}>}add_date) > 1,

     '(' & concat({<add_date = {'>=$(=today()-91)'}>}Replace(add_date, ' ', '?'), '|')& ')',

     only({<add_date = {'>=$(=today()-91)'}>}add_date))

Community Browser