Jeff Moden (2/9/2013)
Freakin' awesome link, Paul. I was able to modify Barry's code to also correctly populate the MX column for the Logoffs so that I could graph the "valleys" as well as the "peaks". I've been trying to do this solution in a similar fashion and got seriously hooked because I just didn't see the 2:1 ratio that Barry included in his final formula. Thanks for posting the link. It's definitely a keeper.
Yes, it's very clever but quite simple at the same time, once the concepts sink in. Once SQL Server supports proper ordered aggregates, the problem will be trivial.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi