Given a schema of user ad interactions, write a SQL query to find the top three most active audience segments per region over a rolling 30-day window at Quantcast.
Use the latest interaction date as the window end. Count interactions after joining valid regions and audience segments. Exclude records outside the window or without valid dimension matches.
Output
- One row per qualifying region and audience segment, with
region_name, segment_name, interaction_count, and activity_rank.
- Include the top three segments per region, ordered by region, rank, and segment name. Ties are resolved alphabetically by segment name.