I have data that is like this:
Date | Day (1st week) | Actual |
2022-06-06 | Mon | 5 |
2022-06-06 | Mon | 2 |
2022-06-06 | Mon | 1 |
2022-06-06 | Mon | 6 |
2022-06-06 | Mon | 7 |
2022-06-07 | Tues | 9 |
2022-06-07 | Tues | 11 |
2022-06-07 | Tues | 8 |
2022-06-07 | Tues | 0 |
2022-06-13 | Mon | 4 |
2022-06-13 | Mon | 10 |
2022-06-13 | Mon | 32 |
2022-06-13 | Mon | 2 |
2022-06-13 | Mon | 5 |
2022-06-14 | Tues | 18 |
2022-06-14 | Tues | 2 |
2022-06-14 | Tues | 3 |
2022-06-14 | Tues | 5 |
2022-06-14 | Tues | 0 |
I want to include a table which has an additional column called Previous while having values from the previous week same day with values. I have dataset technically that spans from Mon to Sun where the weekends data are generally empty. How do I do so in a sequential order? Thank you!
E.g. Mon (Week 1) Actual will be in Forecast of Week 2 etc for the rest of the week
Desired:
Date | Day | Actual | Previous |
2022-06-06 | Mon | 5 | (Prev Mon's data) |
2022-06-06 | Mon | 2 | (Prev Mon's data) |
2022-06-06 | Mon | 1 | (Prev Mon's data) |
2022-06-06 | Mon | 6 | (Prev Mon's data) |
2022-06-06 | Mon | 7 | (Prev Mon's data) |
2022-06-07 | Tues | 9 | (Prev Tues's data) |
2022-06-07 | Tues | 11 | (Prev Tues's data) |
2022-06-07 | Tues | 8 | (Prev Tues's data) |
2022-06-07 | Tues | 0 | (Prev Tues's data) |
2022-06-07 | Tues | 2 | (Prev Tues's data) |
2022-06-13 | Mon (next week) | 4 | 5 |
2022-06-13 | Mon | 10 | 2 |
2022-06-13 | Mon | 32 | 1 |
2022-06-13 | Mon | 2 | 6 |
2022-06-13 | Mon | 5 | 7 |
2022-06-14 | Tues | 18 | 9 |
2022-06-14 | Tues | 2 | 11 |
2022-06-14 | Tues | 3 | 8 |
2022-06-14 | Tues | 5 | 0 |
2022-06-14 | Tues | 0 | 2 |
Edited - Added the dates column
Solved! Go to Solution.
Hi @gabrielvilella , thank you for your solution! Really appreciate it. However, for the initial dataset, both the weeks are in the same table and there are many weeks I have to deal with it. How do I proceed from there?
Edit: I have changed the original dataset.