Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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;
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;