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

Count weekly customers with YTD spend ≥ $1000

Last updated: Apr 25, 2026

Quick Overview

Evaluates cumulative aggregation and temporal grouping skills in the Data Manipulation (SQL/Python) domain, emphasizing window functions for year-to-date running totals, date/week bucketing, partitioning by year, deduplicating distinct customers, and considerations for aggregation performance.

  • hard
  • Databricks
  • Data Manipulation (SQL/Python)
  • Data Scientist

Count weekly customers with YTD spend ≥ $1000

Company: Databricks

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: hard

Interview Round: Technical Screen

You have a transactions table: transactions - date (DATE) — transaction date in UTC - transaction_id (STRING) - customer_id (STRING) - dollars (NUMERIC) — positive spend amount Task (can be solved in SQL or in Python/pandas): For each calendar week, compute the number of distinct customers whose **year-to-date (YTD)** cumulative spend is **at least $1000** as of the end of that week. Definitions/assumptions: - “Year-to-date” means from Jan 1 of the same calendar year through the end of the given week (inclusive). - A “week” starts on Monday; report the week by its week_start_date. - If the table contains multiple years, compute the metric independently per year. Required output: - year (INT) - week_start_date (DATE) - num_customers_ytd_ge_1000 (INT) Order results by year, week_start_date.

Quick Answer: Evaluates cumulative aggregation and temporal grouping skills in the Data Manipulation (SQL/Python) domain, emphasizing window functions for year-to-date running totals, date/week bucketing, partitioning by year, deduplicating distinct customers, and considerations for aggregation performance.

Related Interview Questions

  • Find Top-5 Similar Rows - Databricks (hard)
  • Find top-5 most similar rows across datasets - Databricks (easy)
  • Count weekly customers with ≥$1000 YTD spend - Databricks (easy)
  • Calculate Second-Degree Followers for Each YouTuber - Databricks (Medium)
Databricks logo
Databricks
Dec 12, 2025, 12:00 AM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
6
0

You have a transactions table:

transactions

  • date (DATE) — transaction date in UTC
  • transaction_id (STRING)
  • customer_id (STRING)
  • dollars (NUMERIC) — positive spend amount

Task (can be solved in SQL or in Python/pandas):

For each calendar week, compute the number of distinct customers whose year-to-date (YTD) cumulative spend is at least $1000 as of the end of that week.

Definitions/assumptions:

  • “Year-to-date” means from Jan 1 of the same calendar year through the end of the given week (inclusive).
  • A “week” starts on Monday; report the week by its week_start_date.
  • If the table contains multiple years, compute the metric independently per year.

Required output:

  • year (INT)
  • week_start_date (DATE)
  • num_customers_ytd_ge_1000 (INT)

Order results by year, week_start_date.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Databricks•More Data Scientist•Databricks Data Scientist•Databricks 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.