There is something like this table:
Date | Value ------------------------- 01/11/2018 | 12 02/11/2018 | 14 03/11/2018 | 11 04/11/2018 | 11 05/11/2018 | 177 07/11/2018 | 13 It is necessary to take the last three days from 07.11, if any day is not in this range, then insert the value on this date 9999. In the example above, there is no 06/11. The result should be:
Date | Value ------------------------- 05/11/2018 | 177 06/11/2018 | 9999 07/11/2018 | 13 I can't get the missing date with a fixed value.