Mock interview. You're interviewing for a senior supply chain analyst job at a large retailer. The interviewer explains: "When a product runs out in a store, we lose sales we'll never see in the data. We want an estimate of what stockouts cost us in the first half of 2026."
stockouts is one product out of stock in one store, from out_on up to (not including) back_on. So the days out are back_on - out_on."Start simple: for each department, how many stockouts, how many store-days out of stock in total, and the average length of a stockout?"
Expected output
department, stockouts, days_out, avg_days (rounded to 1 decimal); sorted by days_out, highest firstExample of the shape (made-up values):
| department | stockouts | days_out | avg_days |
|---|---|---|---|
| Garden | 30 | 200 | 6.7 |
Hints, the later steps and the answer come with Pro.
Step 1 of 4
Write your query here. Ctrl + Enter submits.