12-07-2018 02:36 PM
Ok so I got it all wrong from the beginning then.
But if it's so, what is the problem?? you just take the last five dates present in the table from the date in the current row. You do not have to skip anything then.
12-08-2018 04:53 PM
That's an interesting approach, but you have to be careful generalizing it. Indexing the workdays is a good idea, but I'd recommend doing the indexing on your dedicated date table rather than trying to deal with ranking duplicate dates in your fact table.
Another approach would be to use the TOPN function as I suggested here.