All tasks

MAU with Percentage Change

Intermediate

Typical Yandex/VK task. **Condition:** Calculate Monthly Active Users (MAU) for a music service and the percentage change compared to the previous month. **Table:** listening_history (user_id, played_at, ...) **Requirements:** 1. MAU = number of unique users who listened to at least 1 track in the month 2. Calculate % change: (current_mau - prev_mau) / prev_mau * 100 3. Handle the first month case (prev = NULL) **Hint:** DATE_TRUNC + COUNT(DISTINCT) + LAG.

Category
Window Functions
Estimated time
~15 min
Databases
PostgreSQLGreenplum
Tags
YandexInterviewMAULAGMetricsоконные функции

Sign in to solve

Start Solving