Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Offset

I am loading dates from a qvd file and am looking to create a date offset. in other words, if "[Real Date]" is 8/6/2012, i want [Offset Date] to be three days before [Real Date]. i have tried date(only([Real Date])-3) but that will always give me 3 calendar days before (8/3/2012 in my example). i am looking to show only 3 [Real Date]'s ago, to account for weekends and days not othewise loaded as [Real Dates]. a better example might be [Real Date]=7/5/2012. my current expression will give me 7/2/2012, however, due to a weekend and no activity on 7/4, the day i am looking for is 6/29/2012.

1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

Peek([Real Date], RowNo()-4) as [Offset Date]

Just be careful with the edges, where no value is there 3 rows before.

View solution in original post

4 Replies
giakoum
Partner - Master II
Partner - Master II

You could use Peek function to achieve that assuming that not real dates are not in your database.

Not applicable
Author

Thank you Ioannis. so would my script look something like

date(peek([Real Date])-3 as [Offset Date]?

giakoum
Partner - Master II
Partner - Master II

Peek([Real Date], RowNo()-4) as [Offset Date]

Just be careful with the edges, where no value is there 3 rows before.

Not applicable
Author

Great. thank you