Compare Google Store Daily Sales Year Over Year on Matching Weekdays
Last updated: November 29, 2026
Quick Overview
Compute daily Google Store revenue for November 2026 and compare each day with the same weekday one year earlier (364 days back), filling days with no sales as zero.
0
0
0 solved
Compute daily Google Store revenue for November 2026 and compare each day with the same weekday one year earlier (364 days back), filling days with no sales as zero.
Retail sales for the Google Store swing by weekday and around launches and Black Friday, so naive same-date comparisons mislead. The onsite interviewer checks the 364-day alignment, a dense calendar so zero days still compare, and awareness of moving holidays.
What the Interviewer Expects
- Explain why same calendar date comparisons mix weekdays
- Align with a 364-day offset to keep the weekday
- Build a dense calendar so zero-sales days appear
- Aggregate in the store's time zone
- Call out holidays and launch dates that move year to year
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- Thanksgiving was on a different date last year. How would you align Black Friday to Black Friday?
- How would you compare a full week to the same week last year instead of daily?
- A Pixel launch happened in October last year and November this year. How do you present the comparison?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
store_orders(order_id, order_ts, status, net_revenue_usd). Only completed orders count, net of discounts. Days are in Pacific time. I need a year of history plus a little buffer, so I pull from Oct ...
Approach
Aggregate to daily revenue, then left join onto a generated calendar so every day exists with revenue 0 if there were no orders. Self join the dense table to itself on prev.ds = cur.ds - 364 days. 3...