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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Extract on some lines from a table

Hello everyone,

During the script, if I have a table like:

IDRec, IdPers, DataIscr, DataCanc

1 1 01/01/2010 01/03/2010
2 1 01/06/2010
3 2 11/01/2010 21/03/2010
4 3 11/03/2010
5 5 21/01/2011

How can I make the script to extract only one line for each
IdPers, and where there are multiple lines with
the same IdPers value (see IdPers = 1) extract

only the row DataCanc = null?


Thanks to all and hello

2 Replies
prieper
Master II
Master II

Give it a try with the below:

RawData:
LOAD * INLINE [
IDRec, IdPers, DataIscr, DataCanc

1, 1, 01/01/2010, 01/03/2010
2, 1, 01/06/2010
3, 2, 11/01/2010, 21/03/2010
4, 3, 11/03/2010
5, 5, 21/01/2011];

Data:
NOCONCATENATE LOAD
*
RESIDENT
RawData
WHERE
IdPers <> PREVIOUS(IdPers)
ORDER BY
IDRec DESC;

DROP TABLE RawData;


HTH
Peter

Not applicable
Author

Thank Peter, very much.

But why don't I can use an expressin like:

Load *

,firstsortedvalue(dataCanc, -1) as DataCanc2

group by IdPers;

?

Thank All