How would you use SQL window functions to calculate a rolling 7-day average and rank users within each cohort?