Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mahitham
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
chinnuchinni
Creator III
Creator III

Load

DepartmentName,

Departmentid,

Date,

Salary

From ....

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

keerthika
Creator II
Creator II

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

vishalarote
Partner - Creator II
Partner - Creator II

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