Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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
Partner - Champion III
Partner - Champion III

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