Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

How to restrict only Last 2 days data

Hi Experts,

Can any one please help me to restrict only last 2days data in the below extraction.

Load

DepartmentName,

Departmentid,

Date,

Salary

From ....

Here Date is in DD/MM/YYYY hh:mm:ss format. Requirement is Need to extract only Today and previous date data into qvd i.e., need to restrict only last 2days.

Please help me on this.

Thanks in advance.

3 Replies
Highlighted
Creator III
Creator III

Re: How to restrict only Last 2 days data

Load

DepartmentName,

Departmentid,

Date,

Salary

From ....

Where  Date(Date,'MM/DD/YYYY')>=date(Today()-1,'MM/DD/YYYY')

Highlighted
Creator II
Creator II

Re: How to restrict only Last 2 days data

Hi,

You can try like this

Load

DepartmentName,

Departmentid,

date(Date,'MM/DD/YYYY') as Date,

Salary

From ...

where  Date<=date#(date(today()),'MM/DD/YYYY') and Date>=date#(date(today()-1),'MM/DD/YYYY');

Highlighted
Partner
Partner

Re: How to restrict only Last 2 days data

Try this Hope so it will help you.

E.g.

X:

load

Date(MakeDate(2018)+RecNo()-1,'DD/MM/YYYY') as Date,

rand()*1000 as Sales

AutoGenerate 365;


STORE X into 'C:\Project\MyTable6.qvd'(qvd);

DROP Table X;


load *

From 'C:\Project\MyTable6.qvd'(qvd)

where Date>=Today()-1 and Date<=Today();


Capture.PNG