Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Eliminate values with compare dates

Hi All,

I want to load the data where Date2 should not be lesser than Date1.

From the below table, I want to eliminate P1 and P5 as Date2 values are lesser than Date1.

How to achieve? Thanks in advance.

Data:

Load * inline [

Product Date1 Date2

P1 2014 1-Jan-13

P2 2015 2-Jan-15

P3 2016 3-Jan-16

P4 2016 4-Jan-16

P5 2015 5-Jan-14

P6 2015 6-Jan-16

P7 2015 7-Jan-16

P8 2015 8-Jan-16

P9 2015 9-Jan-16

P10 2015 10-Jan-16

];

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Jack,

Have a look at the attached file.

Data:
Load *, If(Date1 <= Date(Date2,'YYYY'),1,0) as CompFlag;
LOAD Product,
Date(Date#(Date1,'YYYY'),'YYYY') as Date1,
Date(Date#(Date2,'DD-MMM-YY'),'DD-MMM-YYYY') as Date2
FROM
Book.xlsx
(
ooxml, embedded labels, table is Sheet1);

NoConcatenate
Final:
Load *
Resident Data Where CompFlag =1;

DROP Table Data;


Result:

Capture.PNG

View solution in original post

2 Replies
Anil_Babu_Samineni

DAte1 you are showing only YEar, Do you want to do in script bu using Iterno()

CAn you confirm this?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tamilarasu
Champion
Champion

Hi Jack,

Have a look at the attached file.

Data:
Load *, If(Date1 <= Date(Date2,'YYYY'),1,0) as CompFlag;
LOAD Product,
Date(Date#(Date1,'YYYY'),'YYYY') as Date1,
Date(Date#(Date2,'DD-MMM-YY'),'DD-MMM-YYYY') as Date2
FROM
Book.xlsx
(
ooxml, embedded labels, table is Sheet1);

NoConcatenate
Final:
Load *
Resident Data Where CompFlag =1;

DROP Table Data;


Result:

Capture.PNG