Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
We have base data coming like below:
Calendar_date | Business_Date |
4/11/2013 | 4/11/2013 |
4/12/2013 | 4/12/2013 |
4/13/2013 | 4/12/2013 |
4/14/2013 | 4/12/2013 |
4/15/2013 | 4/12/2013 |
4/16/2013 | 4/16/2013 |
4/17/2013 | 4/16/2013 |
4/18/2013 | 4/18/2013 |
4/19/2013 | 4/19/2013 |
We want to add another computed column which gives ous previous business date.
Calendar_date | Business_Date | Prev_Business_Date |
4/11/2013 | 4/11/2013 | |
4/12/2013 | 4/12/2013 | 4/11/2013 |
4/13/2013 | 4/12/2013 | 4/11/2013 |
4/14/2013 | 4/12/2013 | 4/11/2013 |
4/15/2013 | 4/12/2013 | 4/11/2013 |
4/16/2013 | 4/16/2013 | 4/12/2013 |
4/17/2013 | 4/16/2013 | 4/12/2013 |
4/18/2013 | 4/18/2013 | 4/16/2013 |
4/19/2013 | 4/19/2013 | 4/18/2013 |
Please help me how can we compute Prev_Business_Date column in the load script?.
Thanks
Dasu.G
Load
...some fields...
if(previous(Business_Date)<>Business_Date, previous(Business_Date), peek(Prev_Business_Date)) as Prev_Business_Date,
...some more fields...
from ...mysource...;
Note: your table needs to be ordered by Calendar_Date or you get funny results.
Load
...some fields...
if(previous(Business_Date)<>Business_Date, previous(Business_Date), peek(Prev_Business_Date)) as Prev_Business_Date,
...some more fields...
from ...mysource...;
Note: your table needs to be ordered by Calendar_Date or you get funny results.