PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/Citi

Compute 30-day power users and 7-day retention

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in aggregation, cohort analysis, date/time arithmetic, and retention metric calculation within the Data Manipulation (SQL/Python) domain at an intermediate level.

  • medium
  • Citi
  • Data Manipulation (SQL/Python)
  • Data Scientist

Compute 30-day power users and 7-day retention

Company: Citi

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Technical Screen

You are interviewing for a Product/Risk Data Scientist role at a crypto exchange. Assume all timestamps are in UTC. ### Tables ```sql trades( user_id BIGINT, trade_time TIMESTAMP, volume NUMERIC, asset VARCHAR ) users( user_id BIGINT, signup_date DATE ) ``` ### Task 1 — 30-day “power trader” share Define the last 30 days as `[CURRENT_DATE - INTERVAL '30 day', CURRENT_DATE)`. Compute the **percentage of active traders** in the last 30 days who made **at least 3 trades** in that same 30-day window. - **Active trader (denominator):** a user with **≥ 1 trade** in the last 30 days. - **Numerator:** users with **trade_count ≥ 3** in the last 30 days. Return one row with: - `active_traders_30d` - `power_traders_30d` - `pct_power_traders_30d` (as a decimal between 0 and 1) ### Task 2 — 7-day retention (trade-based) Define **7-day retention** as: a signed-up user makes **at least one trade on the 7th day after signup**, i.e. on the calendar date `signup_date + 7` (UTC date). For each `signup_date` cohort, compute: - `cohort_size` - `retained_users_d7` - `d7_retention_rate` Notes: - Include users even if they never trade. - A user counts as retained if they have ≥1 trade whose UTC date equals `signup_date + 7`. - Output should be grouped by `signup_date` and ordered by `signup_date` ascending.

Quick Answer: This question evaluates proficiency in aggregation, cohort analysis, date/time arithmetic, and retention metric calculation within the Data Manipulation (SQL/Python) domain at an intermediate level.

Related Interview Questions

  • Write SQL for 30-day activity and D7 retention - Citi (easy)
Citi logo
Citi
Mar 25, 2025, 12:00 AM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
3
0

You are interviewing for a Product/Risk Data Scientist role at a crypto exchange.

Assume all timestamps are in UTC.

Tables

trades(
  user_id      BIGINT,
  trade_time   TIMESTAMP,
  volume       NUMERIC,
  asset        VARCHAR
)

users(
  user_id      BIGINT,
  signup_date  DATE
)

Task 1 — 30-day “power trader” share

Define the last 30 days as [CURRENT_DATE - INTERVAL '30 day', CURRENT_DATE).

Compute the percentage of active traders in the last 30 days who made at least 3 trades in that same 30-day window.

  • Active trader (denominator): a user with ≥ 1 trade in the last 30 days.
  • Numerator: users with trade_count ≥ 3 in the last 30 days.

Return one row with:

  • active_traders_30d
  • power_traders_30d
  • pct_power_traders_30d (as a decimal between 0 and 1)

Task 2 — 7-day retention (trade-based)

Define 7-day retention as: a signed-up user makes at least one trade on the 7th day after signup, i.e. on the calendar date signup_date + 7 (UTC date).

For each signup_date cohort, compute:

  • cohort_size
  • retained_users_d7
  • d7_retention_rate

Notes:

  • Include users even if they never trade.
  • A user counts as retained if they have ≥1 trade whose UTC date equals signup_date + 7 .
  • Output should be grouped by signup_date and ordered by signup_date ascending.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Citi•More Data Scientist•Citi Data Scientist•Citi Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.