Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
siva8
Contributor
Contributor

qlik requirement

Hi Team 

can u please help me with the below requirement 

I have a table i like below

Date,days

2020/09/15,5

2020/09/07,5

2020/09/11,5

2020/09/14,8

I want to calculate  new field start date -- for that i have used function 'FirstWorkDate' like below

FirstWorkDate(Date,days) As StartDate

data looks like below  

Date,days,startdate

2020/09/15,5,2020/09/09

2020/09/07,5,2020/09/01

2020/09/11,5,2020/09/07

2020/09/14,8,2020/09/03

 

But My Requirement here is -- it should not take startdate into consideration while doing calculation (date - days) with firstworkdate

expected output :

2020/09/15,5,2020/09/08

2020/09/07,5,2020/09/31

2020/09/11,5,2020/09/04

2020/09/14,8,2020/09/02

 

Thanks In advance

Thanks 

siva

1 Solution

Accepted Solutions
bhavyagrb
Partner - Contributor II
Partner - Contributor II

Hello Siva,

Please find the script below and output attached. Hope it helps you..

Script below:

data:
load * inline [
Date,days

2020/09/15,5

2020/09/07,5

2020/09/11,5

2020/09/14,8


];

newdata:
load *,
FirstWorkDate(newdate,days,-1)as firstworkdate;
load *,
num(date(date#(Date,'YYYY/MM/DD'),'YYYY/MM/DD'))-1 as newdate
Resident data;

drop table data;

View solution in original post

1 Reply
bhavyagrb
Partner - Contributor II
Partner - Contributor II

Hello Siva,

Please find the script below and output attached. Hope it helps you..

Script below:

data:
load * inline [
Date,days

2020/09/15,5

2020/09/07,5

2020/09/11,5

2020/09/14,8


];

newdata:
load *,
FirstWorkDate(newdate,days,-1)as firstworkdate;
load *,
num(date(date#(Date,'YYYY/MM/DD'),'YYYY/MM/DD'))-1 as newdate
Resident data;

drop table data;