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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
arpitkharkia
Creator III
Creator III

Comparison of dates while doing resident load

Hi all,

I have two tables. Consider the following example.

TableA:

Load     ID,

             DateA,

               ColA,

               ColB

From ...;

Left join(TableA)

TableB:

Load     ID,

             DateB

From ...;

I want a final table where DateA is greater that DateB. Im tring the following:

TableC:

Load *

Resident TableA where (DateA-DateB)>0

Please note there are some tables being left joined to Table A before left joining TableA and TableB

Help appreciated!

1 Solution

Accepted Solutions
Kushal_Chawda

TableA:

Load     ID,

             DateA,

               ColA,

               ColB

From ...;

Left join(TableA)

TableB:

Load     ID,

             DateB

From ...;

New:

noconcatenate

LOAD *,

          if(DateA>DateB,1,0) as Flag

resident TableA;


drop table TableA;


Final:

noconcatenate

LOAD *

resident TableA

where Flag=1;


drop table New;

View solution in original post

3 Replies
Kushal_Chawda

TableA:

Load     ID,

             DateA,

               ColA,

               ColB

From ...;

Left join(TableA)

TableB:

Load     ID,

             DateB

From ...;

New:

noconcatenate

LOAD *,

          if(DateA>DateB,1,0) as Flag

resident TableA;


drop table TableA;


Final:

noconcatenate

LOAD *

resident TableA

where Flag=1;


drop table New;

sasiparupudi1
Master III
Master III

A solution could be like below

Map_DateB:
Mapping LOAD * Inline
[
ID,DateB,
];

TableA:
Load * Inline
[
ID,DateA,ColA,ColB
];

Final:
Load DateA,ColA,ColB
Resident TableA
Where
DateA>ApplyMap('Map_DateB',ID);

arpitkharkia
Creator III
Creator III
Author

Thank you for the response!