Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to get the previous 7 days dates from the current date?

Dates: 11/08/2013 12/01/2013 12/02/2013 12/03/2013 12/04/2013 12/05/2013 12/06/2013 12/07/2013 12/08/2013 12/09/2013 12/10/2013 12/11/2013 12/12/2013 12/13/2013 12/14/2013 12/15/2013 12/16/2013 12/17/2013 12/18/2013 12/19/2013 12/20/2013 12/21/2013 12/22/2013 12/23/2013 12/24/2013 12/25/2013 12/26/2013 12/27/2013 12/28/2013 12/29/2013 12/30/2013 12/31/2013 01/01/2014 01/02/2014 01/03/2014 01/04/2014 01/05/2014 01/06/2014 01/07/2014 01/08/2014 01/09/2014 01/10/2014 01/11/2014 01/12/2014 01/13/2014 01/14/2014 01/15/2014 01/16/2014 01/17/2014 01/18/2014 01/19/2014 01/20/2014 01/21/2014 01/22/2014 01/23/2014 01/24/2014 01/25/2014 01/26/2014 01/27/2014 Suppose I have the above date field "Dates" starting from 11/08/2013 till today i.e, 01/28/2014. I want to display the last week dates ie., my output shud be: Dates: 01/21/2014 01/22/2014 01/23/2014 01/24/2014 01/25/2014 01/26/2014 01/27/2014 Is it possible to do in the script because if i do it in the UI then while performing a search, I can see all dates which i don't need. Thanks in advance!

1 Solution

Accepted Solutions
ashwanin
Valued Contributor

Re: How to get the previous 7 days dates from the current date?

in script add     Where Dates >= Today()-7

5 Replies
Employee
Employee

Re: How to get the previous 7 days dates from the current date?

Load

  date(Today()-RecNo()) as Date,

  WeekStart(Today()-RecNo()) as Week

autogenerate 100;

This script will generate two fiels, one for date e another for Week

giakoum
Honored Contributor II

Re: How to get the previous 7 days dates from the current date?

Date(date_field - 7)

johncaqc
Valued Contributor

Re: How to get the previous 7 days dates from the current date?

Load

     Date

Where Date >= Today()-7;

Or

add the following to Clever Anos' answer (your solution is 100 days, not 7)

Where Date (Today()-RecNo()) >= Today()-7;

ashwanin
Valued Contributor

Re: How to get the previous 7 days dates from the current date?

in script add     Where Dates >= Today()-7

Not applicable

Re: How to get the previous 7 days dates from the current date?

Hi Deepak,

Try this ,

Dev01:

load * Inline [

Date

11/08/2013 12/01/2013 12/02/2013 12/03/2013 12/04/2013 12/05/2013 12/06/2013 12/07/2013 12/08/2013 12/09/2013 12/10/2013 12/11/2013 12/12/2013 12/13/2013 12/14/2013 12/15/2013 12/16/2013 12/17/2013 12/18/2013 12/19/2013 12/20/2013 12/21/2013 12/22/2013 12/23/2013 12/24/2013 12/25/2013 12/26/2013 12/27/2013 12/28/2013 12/29/2013 12/30/2013 12/31/2013 01/01/2014 01/02/2014 01/03/2014 01/04/2014 01/05/2014 01/06/2014 01/07/2014 01/08/2014 01/09/2014 01/10/2014 01/11/2014 01/12/2014 01/13/2014 01/14/2014 01/15/2014 01/16/2014 01/17/2014 01/18/2014 01/19/2014 01/20/2014 01/21/2014 01/22/2014 01/23/2014 01/24/2014 01/25/2014 01/26/2014 01/27/2014

];

Dev02:

LOAD  SubField(Date,chr(32)) as Split_DT Resident Dev01

Where Date(Today()-RecNo()) >= Today()-7;

Regards,

Raja.

Community Browser