Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Previous Date in the Script

Hi ,

      We have base data coming like below:

Calendar_dateBusiness_Date
4/11/20134/11/2013
4/12/20134/12/2013
4/13/20134/12/2013
4/14/20134/12/2013
4/15/20134/12/2013
4/16/20134/16/2013
4/17/20134/16/2013
4/18/20134/18/2013
4/19/20134/19/2013

      We want to add another computed column which gives ous previous business date.

Calendar_dateBusiness_DatePrev_Business_Date
4/11/20134/11/2013
4/12/20134/12/20134/11/2013
4/13/20134/12/20134/11/2013
4/14/20134/12/20134/11/2013
4/15/20134/12/20134/11/2013
4/16/20134/16/20134/12/2013
4/17/20134/16/20134/12/2013
4/18/20134/18/20134/16/2013
4/19/20134/19/20134/18/2013

Please help me how can we compute Prev_Business_Date column in the load script?.

Thanks

Dasu.G

1 Solution

Accepted Solutions
Gysbert_Wassenaar

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.


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar

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.


talk is cheap, supply exceeds demand