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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I include only certain rows in a load script?

Hi all,

I'm new to Qlikview scripting and have found the forum invaluable for helping me overcome problems but I can't find an answer to this one. I have an input table that looks similar to this:-

Transaction RefAction DescriptionAction Date
AREFUND01/03/2013
BSWAP02/03/2013
AREFUND05/03/2013
BREFUND08/03/2013
ACANCEL06/03/2013
BSWAP08/03/2013
ACANCEL12/03/2013

I would like to load only the most recent date for each unique combination of Transaction Ref & Action Description so that the table loaded looks like this:-

REFUNDCANCEL
Transaction RefAction DescriptionAction Date
A05/03/2013
A12/03/2013
BREFUND08/03/2013
BSWAP08/03/2013

Any help or hints on how I should script this would be really appreciated.

Many thanks

1 Solution

Accepted Solutions
sadickbasha
Partner - Contributor III
Partner - Contributor III

Hi Vivienne,

below script will help you resolve the issue

test:
LOAD [Transaction Ref],
    
[Action Description],
num([Action Date]) as [Action Date]
FROM
..\test.xlsx
(
ooxml, embedded labels, table is Sheet3);


NoConcatenate

LOAD
[Transaction Ref],
[Action Description],
Max([Action Date]) as Action_Date
REsident test
Group by
[Transaction Ref],
[Action Description];
 
drop table test;

After reloaded the application , the Action_Date field to be converted to Date(Action_Date,'M/D/YYYY')

by

Sadick

View solution in original post

3 Replies
Not applicable
Author

Transaction RefAction RefLast Action Date
AREFUND05/03/2013
ACANCEL12/03/2013
BREFUND08/03/2013
BSWAP08/03/2013

Sorry - Gremlins in my table. The output should be as above.

sadickbasha
Partner - Contributor III
Partner - Contributor III

Hi Vivienne,

below script will help you resolve the issue

test:
LOAD [Transaction Ref],
    
[Action Description],
num([Action Date]) as [Action Date]
FROM
..\test.xlsx
(
ooxml, embedded labels, table is Sheet3);


NoConcatenate

LOAD
[Transaction Ref],
[Action Description],
Max([Action Date]) as Action_Date
REsident test
Group by
[Transaction Ref],
[Action Description];
 
drop table test;

After reloaded the application , the Action_Date field to be converted to Date(Action_Date,'M/D/YYYY')

by

Sadick

Not applicable
Author

So straightforward. I was overcomplicating things looking at things like FirstSortedValue().

Many, many thanks!