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

Need Help .......

Hi All,

I am facing the following issue, request your help. I have the data which is shown as below.

OfficeStartDateOfficeEndDateContractExtensionDate
16/01/201015/04/201315/12/2012

Based on the above data my desired output will be as below

OfficeStartDateOfficeEndDate
16/1/201015/12/2012
16/12/201215/4/2013

If  ContractExtensionDate is less than my OfficeEndDate then I have to pick up the ContractExtensionDate  as my OfficeEndDate. And ContractExtensionDate +1 will be my OfficeStartDate (In New Row) . And my office end date will be my end Date as shown above.

Thanks in Advance...

Regards,

Alvin.

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Try with this

Load

     Pick(iterno(), OfficeStartDate, Date(Num(ContractExtensionDate) + 1)) AS OfficeStartDate,

     Pick(iterno(), if(ContractExtensionDate < OfficeEndDate, ContractExtensionDate, OfficeEndDate), OfficeEndDate)

     AS OfficeEndDate

Resident TempTable //Assuming your original data is temp table

While

(ContractExtensionDate < OfficeEndDate or iterno() = 1) and iterno() <= 2;


Hope it helps

View solution in original post

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Try with this

Load

     Pick(iterno(), OfficeStartDate, Date(Num(ContractExtensionDate) + 1)) AS OfficeStartDate,

     Pick(iterno(), if(ContractExtensionDate < OfficeEndDate, ContractExtensionDate, OfficeEndDate), OfficeEndDate)

     AS OfficeEndDate

Resident TempTable //Assuming your original data is temp table

While

(ContractExtensionDate < OfficeEndDate or iterno() = 1) and iterno() <= 2;


Hope it helps

alvinford
Contributor III
Contributor III
Author

Hi Adhimulam,

Very thanks for the reply its helps me . But I have a small concern I have applied the same logic for other rows also but its giving a slight different answer .Below is the example.

Data.png

Desired Output

OfficeStartDateOfficeEndDate
01/01/201031/12/2012
01/05/201231/12/2012
01/05/201231/12/2012
01/01/201328/02/2013

Current Output According to your logic . I have underlined the row which there is a difference.

OfficeStartDateOfficeEndDate
01/01/201031/12/2012
01/05/201231/12/2012
01/01/201331/12/2012
01/01/201328/02/2013

Can you please help me to solve this .

Thanks very much for your help.

Regards,

Alvin.

CELAMBARASAN
Partner - Champion
Partner - Champion

Try with this

Load

     Pick(iterno(), OfficeStartDate, Date(Num(ContractExtensionDate) + 1)) AS OfficeStartDate,

     Pick(iterno(), if(ContractExtensionDate < OfficeEndDate

and ContractExtensionDate > OfficeStartDate

, ContractExtensionDate,OfficeEndDate), OfficeEndDate)

     AS OfficeEndDate

Resident TempTable //Assuming your original data is temp table

While

((ContractExtensionDate < OfficeEndDate and ContractExtensionDate > OfficeStartDate) or iterno() = 1) and iterno() <= 2;