Sanjaay Gowda T S
Costco Wholesale Corporation practice

ORIGINAL COMPANY-CONTEXT PRACTICE

Compare sales when package sizes change

SQL & data engineeringHardConcept

Original practice scenario: A hypothetical warehouse-retail report compares product sales before and after a pack changes from twelve units to ten. The SKU identifier is reused. Design the comparison.

Written for independent practice using company context; this is not a verified question from a company interview.

A REASONED APPROACH

Model answer.

Keep package sales and underlying units separate, with an effective-dated product specification. Equal SKU counts do not imply equal quantities when the contents of each package change.

Work through it

  1. Store sale lines at transaction-line grain and join the product specification valid at the sale time, detecting gaps or overlapping specification intervals.
  2. Calculate package count, underlying-unit count and monetary totals separately, preserving returns and any non-equivalent units of measure.
  3. Compare periods using explicit price and promotion context, reconciling totals back to source lines and identifying stock sold under an older packaging version.

Tradeoffs to discuss

  • Standardized-unit comparisons improve continuity but can obscure customer-facing packaging differences; both views may be useful.

Common pitfalls

  • Joining every specification version to one sale multiplies its contribution.
  • Do not infer the package version solely from today's catalog when older stock may still be sold.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub