Write a query using advanced joins, GROUP BY, and window functions to aggregate user activity metrics over a sliding time window at Max AI.