Investigating an Alleged Quarterly Retail Sales Drop

Medium · Analytics & Experimentation · Data Scientist · Technical Screen

Prompt

Executives at a packaged-beverage brand report a second-quarter (Q2 2024) sales contraction and give you 45 minutes plus a single retail point-of-sale transactions table (transaction_id, sale_date, store_id, product_id, region, units, revenue, is_return, with no external store directory, promotional calendar, or inventory feed) to determine whether underlying demand truly declined. Structure an end-to-end analytical plan addressing these six requirements:

  1. Decision context and metric hierarchy: Clarify which concrete business decisions depend on your answer, then define your headline primary metric alongside diagnostic counter-metrics (covering unit volume, realized unit pricing, same-store performance, active footprint, and returns) and explain what each isolates.
  2. Panel granularity and unbiased rollups: Justify the daily store-by-SKU panel grain (store_id x product_id x sale_date) alongside calendar-alignment rules so multi-week and multi-store ratios never suffer from equal-weighting or weekday distortions.
  3. Time-boxed workflow from transactions alone: Lay out an ordered 45-minute execution sequence covering exact quarter cutoffs, sequential (Q1 2024) and seasonal year-over-year (Q2 2023) baselines, inferred same-store filtering, regional/product mix decomposition, return adjustments, out-of-stock proxies, and missing-reporting-day handling.
  4. Spurious-drop sanity checks: Detail at least five targeted checks that catch false alarms—such as store openings or closures, unrepeated promotions or shifting holidays, rate hikes hiding volume erosion, Simpson's paradox across geographic or pack-size segments, return spikes, or delayed late-quarter POS loads.
  5. Core visuals, pre-committed rubric, and executive briefing: Define the minimal set of tables/charts you would show, establish an objective quantitative rule for confirming a genuine decline (for example, >5% drops in both net dollars and net units across both total and same-store cohorts), and script how you would present conclusions, caveats, and next actions in under 3 minutes.
  6. Single highest-leverage extra table: Suppose you receive 5 extra minutes and may join exactly one additional dataset. Name the dataset you would choose, justify why it beats alternatives, and explain how its contents could reverse your business recommendation.

Scope & Expectations

  • Decompose top-line sales cleanly into store footprint, per-store unit velocity, and realized net pricing, computing blended rates strictly as ratios of sums.
  • Respect beverage seasonality, leap-year/weekday alignment, moving holidays, and trailing ingestion lag before classifying stores into a same-store cohort.
  • Use an exact Price / Volume / Mix waterfall to separate genuine volume loss from subgroup weight shifts (Simpson's paradox) and new/discontinued SKUs.
  • Pair a pre-registered decision threshold with a concise, decision-oriented readout that distinguishes confirmed findings from single-table blind spots.

Step-by-step walkthrough

  1. Frame the business decision, headline metric, and diagnostic counter-metrics

    We have only a line-item point-of-sale table (transaction_id, sale_date, store_id, product_id, region, units, revenue, is_return, where return rows carry negative units and revenue) and no external store directory, promo calendar, or inventory log.

    Spend the first minute clarifying what business action hinges on the answer, because different causes require opposite responses: cutting Q3 bottling forecasts, rolling back a price hike, fixing warehouse stockouts, or paging data engineering for a stalled June data feed.

    Total revenue factors cleanly into store footprint, consumer volume, and realized unit pricing:

    Net Revenue = Active Stores  x  (Net Units / Active Store)  x  (Net Revenue / Net Units)
                  \___________/     \________________________/     \_______________________/
                    Footprint             Store Velocity              Realized Net Price
    

    A headline drop in revenue is ambiguous until paired with counter-metrics—companion metrics designed to isolate which factor actually moved:

    Metric Role Why it is needed
    Net revenue (gross sales minus returns) Primary metric Directly evaluates leadership's claim of a second-quarter sales contraction
    Net units sold Counter-metric Separates true consumer volume demand from pricing or discounting shifts
    Realized net price (SUM(revenue) / SUM(units)) Counter-metric Reveals price hikes masking unit erosion, or heavy promos deflating dollars
    Same-store revenue & same-store units Counter-metric Holds store footprint constant to separate organic demand from store closures
    Active store count & active SKU count Counter-metric Measures distribution expansion, closures, or delistings
    Return rate (|return_revenue| / gross_revenue) Counter-metric Catches Q2 return spikes or cross-quarter wholesale buybacks
  2. Choose the store-product-day grain and align baseline periods

    Analysis grain: Aggregate raw receipts immediately to store_id x product_id x sale_date (one row per store, product, and calendar day). Individual receipts are noisy, whereas store x product x day is the finest grain where absence of rows meaningfully signals zero daily sales, store feed dropouts, or multi-day stockouts. Always build higher-level rollups by summing from this daily panel—never by averaging pre-computed store or daily averages.

    Baseline selection for Q2 2024 (2024-04-01 to 2024-06-30): - Q2 2023 (Year-over-Year / YoY) — primary baseline: Beverage demand is strongly seasonal (warm spring/summer weather lifts Q2 consumption). Comparing Q2 2024 against Q2 2023 matches the seasonal cycle. - Q1 2024 (Quarter-over-Quarter / QoQ) — momentum baseline: Captures recent trajectory, best interpreted via a seasonal ratio check: compare Q2 2024 / Q1 2024 against Q2 2023 / Q1 2023. If Q2 normally jumps +12% over Q1 due to summer heat (2023) but only rose +2% this year (2024), demand decelerated sharply even though raw QoQ is positive.

    Four alignment rules to keep comparisons unbiased: 1. Calendar length and leap-year weekday balance: Q2 2023 (Apr–Jun), Q1 2024 (Jan–Mar, a 2024 leap year with 29 days in February), and Q2 2024 (Apr–Jun) each span 91 days = 13 complete 7-day weeks, meaning each contains 13 of every weekday. However, Q1 2023 had 90 days (normalize per day), and 2023-04-01 was a Saturday whereas 2024-04-01 was a Monday—so if you trim incomplete late-June days, always trim a multiple of 7 days (for example 7 days -> 84 = 12 * 7 days) so one quarter does not gain an extra summer weekend. 2. Sum first, divide once (ratio of sums): Compute average price as SUM(net_revenue) / SUM(net_units) across the period, never AVG(daily_price) or AVG(store_price), which weights a 5-unit kiosk equally with a 5,000-unit supermarket. 3. Identical store denominators: Per-store velocity must use the verified same-store cohort in both periods. 4. Moving-holiday alignment: Easter fell on 2023-04-09 (inside Q2 2023) but shifted to 2024-03-31 (inside Q1 2024)—pulling pre-Easter beverage stocking out of Q2 2024 relative to both baselines. Re-check totals excluding the Easter weeks.

  3. Execute the 45-minute step-by-step analysis plan

    Order the workflow so data bugs are caught before defining cohorts or computing bridges:

    1. Audit raw extract & trailing latency (4 min): Check min/max sale_date, daily row counts, duplicate transaction_ids, and non-return rows with units <= 0. If the last 7 days of June 2024 show a 40% row-count cliff from delayed POS uploads, trim the final 7 days (Jun 24–30) from both Q2 2024 and Q2 2023 so late loads are not mistaken for closed stores.
    2. Build the store x product x day panel (3 min): Materialize gross_units, gross_rev, return_units, return_rev, and net_rev per store-product-day.
    3. Mitigate missing-days bias (4 min): Count active reporting days per store per quarter. A $1,000/day store earns $91,000 in 91 days; if 9 daily POS files failed to load, recorded revenue drops to $82,000 (-9.9%) with zero change in shopper demand. Compute revenue per reporting store-day, restrict sensitivity checks to stores reporting >= 95% of expected open days, and drop system-wide missing dates along with the matching weekday/week-of-quarter in the baseline.
    4. Construct the same-store filter (4 min): Without a store master, infer operating lifespan on the latency-trimmed window: classify a store as same-store if it recorded sales in Week 1 of the baseline quarter, in the final complete week of Q2 2024, and in at least 11 of 13 weeks in each quarter. Using full weeks (instead of single boundary dates like Sunday 2024-06-30) keeps stores closed on Sundays in the cohort, while the 11/13 week rule filters out 2-month remodel closures.
    5. Compute overall and same-store scorecards (3 min): Tabulate YoY and QoQ % deltas across all primary and counter-metrics.
    6. Isolate returns behavior (2 min): Compare gross vs. net deltas and flag Q2 return rows lacking prior Q2 sales (Q1 promo overstock returned in April).
    7. Run Price / Volume / Mix decomposition (5 min): Decompose same-store gross revenue shifts by region and product_id (detailed next).
    8. Estimate stockout proxy (5 min): Among high-velocity (store, product) pairs selling on >= 90% of days in baseline, flag anomalous runs of >= 7 consecutive zero-sale days while the store itself remained active on other SKUs. Approximate lost stockout revenue as zero_run_days * baseline_daily_sku_revenue (leaving 15 minutes for sanity checks and synthesis).
  4. Separate price, volume, and mix effects (and Simpson's paradox)

    Even when total units stay flat and every region raises prices, overall revenue and average price can plunge due to Simpson's paradox—when a shift in subgroup weights reverses an aggregate rate:

    Region    Q2 2023 Units   Price    Revenue     Q2 2024 Units   Price (+5%)   Revenue
    ------    -------------   -----    -------     -------------   -----------   -------
    West           800        $2.00    $1,600           400           $2.10        $840
    East           200        $1.00      $200           600           $1.05        $630
    ------    -------------   -----    -------     -------------   -----------   -------
    Total        1,000        $1.80    $1,800         1,000           $1.47      $1,470  (-18.3%)
    

    Both regions raised prices +5% and total volume held at 1,000 units, yet total revenue fell -$330 (-18.3%) because 40% of unit share migrated from premium West ($2.00) to discount East ($1.00). An exact Price / Volume / Mix bridge separates the three drivers cleanly (plus a fourth bucket for newly launched or discontinued SKUs so zero baseline units never cause division by zero):

    For continuing cells i with unit shares s_ia = u_ia / U_a and s_ib = u_ib / U_b:
      Volume effect = (U_b - U_a) * P_a                       (total demand size at old blended price)
      Mix effect    = U_b * SUM_i (s_ib - s_ia) * p_ia        (unit-share shift across cheap/expensive cells)
      Price effect  = SUM_i (p_ib - p_ia) * u_ib              (within-cell price changes at new volumes)
      Identity:       Volume + Mix + Price = R_b - R_a        ($0 - $400 + $70 = -$330)
    
    def revenue_bridge(cells_baseline: dict, cells_current: dict) -> dict:
        """Decompose R_b - R_a across {cell: (units, revenue)} into volume, mix, price, and launches."""
        all_cells = sorted(set(cells_baseline) | set(cells_current))
        continuing = [
            c for c in all_cells
            if cells_baseline.get(c, (0, 0.0))[0] > 0 and cells_current.get(c, (0, 0.0))[0] > 0
        ]
    
        u_a_total = sum(cells_baseline[c][0] for c in continuing)
        r_a_total = sum(cells_baseline[c][1] for c in continuing)
        u_b_total = sum(cells_current[c][0] for c in continuing)
        blended_price_a = r_a_total / u_a_total
    
        volume_effect = (u_b_total - u_a_total) * blended_price_a
        mix_effect = 0.0
        price_effect = 0.0
    
        for cell in continuing:
            u_a, r_a = cells_baseline[cell]
            u_b, r_b = cells_current[cell]
            price_a, price_b = r_a / u_a, r_b / u_b
            share_a, share_b = u_a / u_a_total, u_b / u_b_total
            # Mix measures share shifts valued at baseline cell prices; price measures pure rate shifts
            mix_effect += u_b_total * (share_b - share_a) * price_a
            price_effect += (price_b - price_a) * u_b
    
        # Isolate newly launched or discontinued SKUs/regions that lack a price in one period
        new_or_discontinued = sum(
            cells_current.get(c, (0, 0.0))[1] - cells_baseline.get(c, (0, 0.0))[1]
            for c in all_cells if c not in continuing
        )
        return {
            "volume": round(volume_effect, 2),
            "mix": round(mix_effect, 2),
            "price": round(price_effect, 2),
            "new_or_discontinued": round(new_or_discontinued, 2),
            "total_change": round(volume_effect + mix_effect + price_effect + new_or_discontinued, 2),
        }
    
    
    print(revenue_bridge(
        {"West": (800, 1600.0), "East": (200, 200.0)},
        {"West": (400, 840.0), "East": (600, 630.0)},
    ))
    # {'volume': 0.0, 'mix': -400.0, 'price': 70.0, 'new_or_discontinued': 0, 'total_change': -330.0}
    
  5. Audit eight common sources of spurious declines

    Run eight fast diagnostic checks on the daily panel before calling any decline real:

    1. Trailing data-ingestion lag: Plot daily transaction count across Q2 2024; a sharp late-June drop indicates delayed store batch uploads rather than lost sales.
    2. Store openings and closures: Compare total revenue delta against same-store delta; if overall revenue is -7% while same-store is 0%, distribution footprint shrank while shopper demand held steady.
    3. Mid-quarter store reporting gaps: Check reporting_days per store; a drop concentrated in stores missing whole weeks points to broken POS connectors.
    4. Unrepeated baseline promotions & Easter shift: Flag weeks in Q2 2023 where units spiked >2x at depressed unit prices (unrepeated BOGO promo) plus the April 2023 Easter week; recompute YoY excluding promo/Easter windows.
    5. Rate hikes obscuring volume erosion (or heavy discounting): Revenue -1% with units -9% and price +9% is severe volume erosion masked by pricing—an urgent warning sign despite flat dollars.
    6. Regional or pack-size Simpson's paradox: Compare overall average-price and per-store velocity changes against within-region and single-can vs. 12-pack trends.
    7. Cross-quarter returns spike: Check whether return share jumped in April 2024 from retailers returning unsold Q1 promotional pallets.
    8. Duplicate IDs and B2B wholesale outliers: Deduplicate transaction_id and test whether capping the top 0.1% largest transactions (such as a one-off stadium order in Q2 2023) flips the sign.
  6. Structure core deliverables, pre-committed thresholds, and the executive pitch

    Lock an objective interpretation rubric before inspecting headline numbers:

    "Real Demand Decline Confirmed" (YoY Q2 2024 vs. Q2 2023) requires ALL four criteria:
      1. Overall net revenue < -5.0%  AND  overall net units < -5.0%
      2. Same-store net revenue < -5.0%  AND  same-store net units < -5.0%
      3. Breadth & precision: > 50% of same-stores declined, AND a store-cluster bootstrap 95% CI excludes 0%
      4. Survives data hygiene: decline persists after deduplication, latency trimming, and Easter adjustment
    
    Observed metric signature Diagnostic conclusion
    Overall & same-store revenue and units all < -5%, broad across stores True demand decline (investigate category/competitor)
    Overall < -5%, same-store within +/-2% Footprint contraction (store closures or lost accounts)
    Revenue < -5%, units flat/up Discounting or negative mix shift (check bridge)
    Revenue flat, units < -5% Hidden volume erosion masked by price hikes
    Decline vanishes after trimming late June Data-latency false alarm (wait for backfill)

    Four minimal presentation outputs: 1. Executive scorecard table: Q2 2024 vs. Q2 2023 (YoY) and vs. Q1 2024 (QoQ) across all 6 metrics, overall and same-store. 2. 13-week aligned revenue & unit trend chart: Three quarterly lines plotted by week-of-quarter (W1..W13), annotating Easter and major promo spikes. 3. Exact waterfall bridge chart: Q2 2023 Net Revenue -> Store Footprint -> Same-Store Volume -> Mix -> Price -> New/Discontinued SKUs -> Returns Delta -> Q2 2024 Net Revenue. 4. Sanity-check traffic-light table: Which of the 8 false-alarm checks fired and how many points each explained.

    Under-3-minute executive communication script (Answer -> Evidence -> Caveats -> Next Step):

    "Bottom line: Q2 beverage demand did decline year-over-year, though roughly a quarter of the headline drop is store footprint rather than shopper demand. On complete aligned weeks, total net revenue fell 7.8% and units fell 6.5% vs. Q2 2023. Across same-stores active throughout both years, revenue is down 5.4% and units 5.1% (95% store-bootstrap CI [-7.6%, -3.1%]), with 64% of stores declining—confirming a broad volume drop under our -5% rubric, while 11 closed stores explain 2.4 points of the headline loss. Two caveats from our data audit: I trimmed the final 7 days of June from both years due to incomplete POS ingestion, and the March 2024 Easter shift accounts for roughly 1 point of April's softness. Because this table lacks inventory and promo calendars, I cannot yet separate shopper walk-aways from shelf stockouts—though consecutive zero-sale runs appeared in 8% of top SKUs. Immediate recommendation: treat ~5% same-store unit softness as real, inspect inventory on those flagged SKUs before cutting price, and refresh next week once late-June data lands." (Numbers illustrative.)

  7. Prioritize the single highest-value additional dataset

    With transactions alone, 0 sales on a given store-day is fundamentally ambiguous between four realities: zero shopper demand, an empty shelf, a closed store, or a broken data feed. If granted 5 minutes and one additional dataset, request the Authoritative Store Master (store_id, region, chain_banner, open_date, close_date, temporary_closure_dates):

    • Why this dataset wins first: Every demand conclusion rests on the same-store filter, which currently guesses openings and closures from first/last transaction dates—conflating a store that stopped transmitting June POS files with a permanent store closure. Official open/close dates make same-store membership, regional mix, and missing-day detection exact in a single JOIN.
    • How it changes the conclusion:
      1. If stores that went silent in June are still officially open, the apparent footprint drop is actually an unreported POS pipeline outage, changing the recommendation from business intervention to "halt conclusions and backfill missing store feeds."
      2. If those stores genuinely closed, footprint loss is proven and leadership focuses distribution teams on account retention while sizing organic demand strictly from verified same-stores.

    (Note: if a reliable store roster were already embedded and our stockout proxy flagged widespread multi-day zero runs inside active same-stores, the single highest-value alternative would be Daily Store x SKU Beginning-of-Day Inventory, which cleanly flips the action from marketing promotions to supply-chain replenishment.)

Intuition & how it works

Evaluating an alleged second-quarter retail slump from a single point-of-sale table inside 45 minutes is like diagnosing a sudden drop in a runner's weekly mileage from a GPS watch file alone: before blaming fitness, you check whether Friday's run failed to sync, whether they ran 5 days instead of 6, or whether steep hills slowed their pace. In retail analytics, total dollar sales equals active stores x units per store x realized price per unit, and each piece points to a completely different business decision.

A naive analyst runs SELECT quarter, SUM(revenue) FROM transactions GROUP BY quarter, sees Q2 lower than Q1 or last year, and declares a demand crisis. That approach fails because raw totals mix store closures, delayed late-June data feeds, holiday calendar shifts, return spikes, and regional mix shifts into one blended number. Worse, comparing beverage sales solely against Q1 ignores strong summer seasonality, while averaging daily store prices weights tiny convenience kiosks equally with high-volume supermarkets.

Walk through a tiny 2-region beverage example (West at $2.00 -> $2.10 and East at $1.00 -> $1.05, 1,000 total units in both years):

  1. Headline alarm: Total revenue drops from $1,800 in Q2 2023 to $1,470 in Q2 2024 (-18.3%), and blended price drops from $1.80 to $1.47—making it look like steep discounting crushed revenue.
  2. Counter-metrics & same-store check: Total units are completely flat (1,000 vs. 1,000), ruling out a total volume collapse.
  3. Price / Volume / Mix bridge: Decomposing by region reveals West shifted from 800 -> 400 units while cheaper East grew from 200 -> 600 units: volume contributed $0, within-region +5% price increases added +$70, and regional mix shift subtracted -$400 ($0 - $400 + $70 = -$330). Instead of panic-cutting prices, leadership sees every region held pricing power while volume migrated east.

Key points

  • Anchor metrics to the business decision. Pair net revenue (gross sales minus returns) with counter-metrics—diagnostic companion metrics (net units, realized net price, same-store revenue/units, active stores, return share) that separate store footprint, shopper volume, and pricing.
  • Aggregate to store x product x day first. An analysis grain defines what one row represents (1 store, 1 SKU, 1 calendar day); summing up from this daily panel preserves zero-sale days for stockout and missing-feed checks while computing ratios properly as ratios of sums (SUM(revenue) / SUM(units)).
  • Use Year-over-Year (Q2 2023) as primary baseline, checked against seasonal QoQ. Q2 2023, leap-year Q1 2024, and Q2 2024 each span 91 days (13 full weeks, 13 of every weekday); trim any incomplete late-June ingestion lag in multiples of 7 days (84 days) to keep weekend beverage counts balanced, and adjust for moving holidays like Easter (2023-04-09 in Q2 vs. 2024-03-31 in Q1).
  • Filter to same-stores after trimming data latency. Same-store sales restricts comparisons to stores continuously operating across both periods (active in the opening week, the final complete week, and >= 11 of 13 weeks) so closed stores and delayed June uploads are not mistaken for falling shopper demand.
  • Decompose changes with a Price / Volume / Mix bridge. A revenue bridge algebraically splits R_b - R_a into total unit volume, subgroup share shifts (mix), within-cell price changes, and newly launched/discontinued SKUs—preventing Simpson's paradox (when shifting subgroup weights make a blended average move opposite to every individual subgroup).
  • Pre-register the decline rubric and request the Store Master next. Require >5% YoY drops in both revenue and units (overall and same-store) across a majority of stores after hygiene checks, and prioritize an authoritative Store Master dataset (open_date, close_date, region) to resolve transaction-only ambiguity between store closures and broken POS feeds.

Common mistakes

  • Comparing Q2 only against Q1 on a seasonal product like beverages, either mistaking normal spring/summer weather swings for growth or missing a real YoY slowdown.
  • Defining the same-store filter on raw June 30 before checking ingestion lag, misclassifying open stores with delayed late-June POS uploads as permanently closed stores.
  • Trimming a non-multiple of 7 days (like 5 days) across a leap year (2024 vs. 2023), leaving one comparison period with an extra high-volume summer weekend.
  • Taking an unweighted average of store or daily prices (AVG(revenue / units)), letting tiny low-traffic stores distort the chain-wide price trend.
  • Dividing by zero on newly launched or discontinued SKUs inside a price/volume/mix bridge instead of isolating non-overlapping SKUs in their own bucket.
  • Treating days with zero rows as proven zero shopper demand, ignoring stockouts, Sunday closures, and dropped data files.
  • Inventing the -5% threshold after looking at the numbers to fit a pre-existing narrative.

Follow-up questions

  • Headline revenue fell 8% year-over-year, yet same-store revenue and unit volume each grew 0.5%. What should you recommend to executives? Tell them consumer demand per open store is completely healthy (+0.5%), and the entire 8% drop comes from store footprint contraction—either permanent store closures, lost retail banner accounts, or stores whose POS feeds stopped reporting. Quantify the exact dollar gap attributable to non-same-stores and verify with Account Management / IT which silent stores actually closed vs. suffered data-feed outages. Warn leadership not to launch margin-destroying price cuts or promotions, which cannot fix closed doors.
  • How can you compute a defensible confidence interval around the same-store sales change within the 45-minute window? Run a quick cluster bootstrap at the store level: resample the N same-stores with replacement 1,000 times, sum revenue_2024 and revenue_2023 across each resampled store list, and take the 2.5th and 97.5th percentiles of SUM(rev_2024) / SUM(rev_2023) - 1. Resampling whole stores (rather than individual receipts or days) respects serial correlation within each store, while pairing the interval with a leave-one-week-out check (dropping Easter and the biggest promo week) proves the conclusion is not driven by 3 outlier stores or 1 holiday week.
  • Once a true 5% same-store volume drop is verified, how would you narrow down the root cause next? Decompose the same-store unit loss across regions, store formats (convenience vs. grocery), pack sizes (immediate-consumption single cans vs. take-home multi-packs), and flavors using the bridge to see whether the drop is concentrated in 2 SKUs or chain-wide. Plot the week-by-week YoY unit ratio inside Q2: a sharp step-down in one specific week points to an operational event (competitor promo launch, shelf reset/delisting, or warehouse stockout), whereas a smooth 13-week slide points to gradual category or brand erosion.

Follow-up questions

Similar questions

More Fetch Rewards interview questions

All 4 Fetch Rewards questions →