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: 
chrisk44
Contributor III
Contributor III

Start and end dates in selected periods

Hello,

I've got this source table:

 

EMPL_NO DATE_FROM DATE_TO  EMPL_DATE CHANGE_DATE PERIOD 
44892006-10-112006-11-102006-10-112006-10-11177758
44892006-10-112006-12-312006-10-112006-11-11177758
44892007-01-012007-03-312007-01-012007-01-01178319
44892007-04-012007-09-302007-04-012007-04-01179654
44892007-10-012008-04-302007-10-012007-10-01204028
44892007-10-012009-12-312007-10-012008-05-01204028
44892007-10-012010-09-302007-10-012010-01-01204028
44892007-10-012015-03-312007-10-012010-10-01204028
44892007-10-012016-04-302007-10-012015-04-01204028
44892007-10-01 _________                  2007-10-012016-05-01204028

 

 

Need to select first date_from in each period and last date_to in each period

Result table should be like that:

EMPL_NO DATE_FROM DATE_TO PERIOD 
44892006-10-112006-12-31177758
44892007-01-012007-03-31178319
44892007-04-012007-09-30179654
44892007-10-01 204028

 

I'm new to QV so I ask for your understanding

 

Regards

10 Replies
chrisk44
Contributor III
Contributor III
Author

Found a solution in another Thread:

[tmp]:

load
EMPL_NO,
DATE_FROM,
if (isnull(DATE_TO),Today()+100,DATE_TO) as DATE_TO,
PERIOD;
SELECT
FROM 

NoConcatenate
tmp2:
LOAD
EMPL_NO,
PERIOD,
date(MIN(DATE_FROM)) as min_DATE_FROM
,if (max(DATE_TO)=today()+100,null(),date(max(DATE_TO))) as max_DATE_TO
Resident tmp
Group By
EMPL_NO,PERIOD;

 

Regards