Week Ending Date Calculation
We have a really typical looking Date table. However, we are going to be drawing some pretty charts summarized by weeks, and our business defines "end of week" at Saturday. So, we need a new column in our Date table that stores this "Week Ending" date for each row. The first thought to occur to me was "well, for each Year&WeekOfYear, I just want to grab the max date". That sounded easy enough. EARLIER() no longer scares me.
Read more...