Queries · q240 · Chief Operating Officer · week 2, night 3
“How much better would Lowlands Express's orders perform, and how much would that help overall, if we only used it on its strong home lanes (Netherlands, Belgium, France) and moved everything else off it?”
Fictional people at a fictional company, each played by a language-model agent. Who they are and what they are told
The manager, at the start of week 2
Subject: Carrier picture confirms it — now I want to know what we can actually fix
Lena,
This is exactly the clarity I was hoping for — "it's the carriers, not the warehouses" is a much more actionable story than "fulfillment is inconsistent." A few things jumped out, including from what Daniel's and Tomasz's teams posted this week, and I want to chase them down before we draft anything for merchants or carrier partners.
What surprised me: Albion Parcel going from solid to broken in November and staying broken through December is different from Landfall and Lowlands, which sound like long-term weak performers we've just tolerated. One is a relationship we may need to end; the other looks like it could be an acute problem (capacity, a route, a depot) that might actually be fixable if we understood the trigger. I don't want to lump all three into one "bad carriers" conversation when they may need completely different responses.
I also noticed Daniel's team's finding that "where's my order" tickets spike in lockstep with late deliveries each November/December — that's a direct line from the carrier problem to support cost and customer satisfaction, and I'd like to be able to say that explicitly in my own numbers rather than borrowing his.
Questions for this week:
If it's a tight week, prioritize #1 and #2 — I want the carrier narrative airtight before I take it anywhere. Returns/restock cycle time can wait one more week if needed.
Thanks, Priya
The analyst · week 2, night 3, request 3 of 3
I can already answer most of priorities #2-#4 by hand from data I have: (a) the full-year carrier table lets me compute that today's overall transit on-time rate (pct within 3 days) is ~78%, and if the three weak carriers matched the ~88% weighted average of the other 11 carriers, overall on-time would rise to ~88% -- i.e. roughly 45% of our current unreliability sits with these three carriers, the rest is baseline slop even among good carriers. (b) the non-censored PO report fully resolves #3: pct_matured_still_open is ~0% in every quarter including the mature Oct-only slice of Q4 -- there is no real backlog, the 418 "open" POs were purely a right-censoring artifact. The late-delivery rate itself (47-59%) is real and chronic, but it's a persistent promise-miss rate, not a growing queue -- worth flagging as its own issue. (c) the vertical report resolves #4: Beauty and Apparel & Footwear have the highest fulfillment-shortfall rates (4.5-4.7% of orders), but Apparel is actually the fastest and most reliable vertical once an order fully delivers (3.84 avg days, 82.4% within 5) -- so the picking-discrepancy issue looks like a separate, real completeness problem (customers getting short quantities), not a delivery-speed problem. Tonight I want to re-express the carrier "ceiling" story in the exact metric Priya already quotes (order-level pct-within-5-days, not shipment transit), and isolate how much of the Nov-Dec dip is specifically attributable to Albion vs. everything else, plus quantify the Lowlands lane-fix opportunity -- these three numbers should make the carrier narrative airtight and actionable.
The engineer · 1 dry run on the empty schema, then the submission
WITH t0 AS ( SELECT o.id AS order_id, o.placed_at, o.shipping_address_id, s.carrier, s.delivered_at, (EXTRACT(EPOCH FROM (s.delivered_at - o.placed_at)) / 86400.0) AS delivery_days FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id WHERE o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND o.status = 'fulfilled' AND s.delivered_at IS NOT NULL AND (SELECT COUNT(*) FROM fulfillments f2 WHERE f2.order_id = o.id) = 1 AND (SELECT COUNT(*) FROM shipments s2 WHERE s2.fulfillment_id = f.id) = 1 ), t1 AS ( SELECT t0.order_id, t0.delivery_days, CASE WHEN t0.carrier = 'Lowlands Express' AND c.name IN ('Netherlands', 'Belgium', 'France') THEN 'Lowlands core (NL/BE/FR)' WHEN t0.carrier = 'Lowlands Express' THEN 'Lowlands non-core (other countries)' ELSE 'All other carriers' END AS lane_group FROM t0 LEFT JOIN addresses a ON a.id = t0.shipping_address_id LEFT JOIN countries c ON c.id = a.country_id ), t2 AS ( SELECT t1.lane_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(t1.delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN t1.delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days FROM t1 GROUP BY t1.lane_group ), t3 AS ( SELECT COUNT(*) AS total_orders FROM t1 ) SELECT t2.lane_group, t2.orders_fully_delivered, t2.avg_delivery_days, t2.pct_within_5_days, ROUND(100.0 * t2.orders_fully_delivered / t3.total_orders, 1) AS share_of_orders_pct FROM t2 CROSS JOIN t3 ORDER BY CASE t2.lane_group WHEN 'Lowlands core (NL/BE/FR)' THEN 1 WHEN 'Lowlands non-core (other countries)' THEN 2 ELSE 3 END, t2.lane_group
“Looks correct and compiles. Submitting.”
“Submitted. The report computes, per lane_group ('Lowlands core (NL/BE/FR)', 'Lowlands non-core (other countries)', 'All other carriers'): order count, average delivery days (delivered_at − placed_at), % delivered within 5 days, and each group's share of total qualifying orders — using the same 2025/fulfilled/single-fulfillment/single-shipment/delivered scoping as the other reports in this set.”
As Lena Hartmann saw it, from the small dataset the agents worked on
lane_group | orders_fully_delivered | avg_delivery_days | pct_within_5_days | share_of_orders_pct ------------------------------------+------------------------+-------------------+-------------------+-------------------- Lowlands core (NL/BE/FR) | 1581 | 4.34 | 72.9 | 7.7 Lowlands non-core (other countries) | 864 | 5.96 | 34.1 | 4.2 All other carriers | 18088 | 3.92 | 82.0 | 88.1 (3 rows)
The memo and the queries that followed; links found by title, so inferred
Later queries that build on this report:
It builds on:
Changed only where the benchmark needs the same result on every system
WITH t0 AS ( SELECT o.id AS order_id, o.placed_at, o.shipping_address_id, s.carrier, s.delivered_at, (EXTRACT(EPOCH FROM (s.delivered_at - o.placed_at)) / 86400.0) AS delivery_days o.placed_at AS placed_at, o.shipping_address_id AS shipping_address_id, s.carrier AS carrier, s.delivered_at AS delivered_at, ({{seconds_between(o.placed_at, s.delivered_at)}} / 86400.0) AS delivery_days FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id WHERE o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND o.status = 'fulfilled' AND s.delivered_at IS NOT NULL AND (SELECT COUNT(*) FROM fulfillments f2 WHERE f2.order_id = o.id) = 1 AND (SELECT COUNT(*) FROM shipments s2 WHERE s2.fulfillment_id = f.id) = 1),t1 AS ( SELECT t0.order_id, t0.delivery_days, t0.order_id AS order_id, t0.delivery_days AS delivery_days, CASE WHEN t0.carrier = 'Lowlands Express' AND c.name IN ('Netherlands', 'Belgium', 'France') THEN 'Lowlands core (NL/BE/FR)' WHEN t0.carrier = 'Lowlands Express' THEN 'Lowlands non-core (other countries)' ELSE 'All other carriers' END AS lane_group FROM t0 LEFT JOIN addresses a ON a.id = t0.shipping_address_id LEFT JOIN countries c ON c.id = a.country_id),t2 AS ( SELECT t1.lane_group, t1.lane_group AS lane_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(t1.delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN t1.delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days AVG(t1.delivery_days) AS avg_delivery_days, 100.0 * SUM(CASE WHEN t1.delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*) AS pct_within_5_days FROM t1 GROUP BY t1.lane_group),t3 AS ( SELECT COUNT(*) AS total_orders FROM t1)SELECT t2.lane_group, t2.orders_fully_delivered, t2.avg_delivery_days, t2.pct_within_5_days, ROUND(100.0 * t2.orders_fully_delivered / t3.total_orders, 1) AS share_of_orders_pct t2.lane_group AS lane_group, t2.orders_fully_delivered AS orders_fully_delivered, t2.avg_delivery_days AS avg_delivery_days, t2.pct_within_5_days AS pct_within_5_days, 100.0 * t2.orders_fully_delivered / t3.total_orders AS share_of_orders_pctFROM t2CROSS JOIN t3ORDER BY CASE t2.lane_group WHEN 'Lowlands core (NL/BE/FR)' THEN 1 WHEN 'Lowlands non-core (other countries)' THEN 2 ELSE 3 END, t2.lane_group END NULLS LAST, t2.lane_group NULLS LAST
WITH t0 AS ( SELECT o.id AS order_id, o.placed_at AS placed_at, o.shipping_address_id AS shipping_address_id, s.carrier AS carrier, s.delivered_at AS delivered_at, (CAST(EXTRACT(EPOCH FROM (s.delivered_at - o.placed_at)) AS NUMERIC(18,6)) / 86400.0) AS delivery_days FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id WHERE o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND o.status = 'fulfilled' AND s.delivered_at IS NOT NULL AND (SELECT COUNT(*) FROM fulfillments f2 WHERE f2.order_id = o.id) = 1 AND (SELECT COUNT(*) FROM shipments s2 WHERE s2.fulfillment_id = f.id) = 1 ), t1 AS ( SELECT t0.order_id AS order_id, t0.delivery_days AS delivery_days, CASE WHEN t0.carrier = 'Lowlands Express' AND c.name IN ('Netherlands', 'Belgium', 'France') THEN 'Lowlands core (NL/BE/FR)' WHEN t0.carrier = 'Lowlands Express' THEN 'Lowlands non-core (other countries)' ELSE 'All other carriers' END AS lane_group FROM t0 LEFT JOIN addresses a ON a.id = t0.shipping_address_id LEFT JOIN countries c ON c.id = a.country_id ), t2 AS ( SELECT t1.lane_group AS lane_group, COUNT(*) AS orders_fully_delivered, AVG(t1.delivery_days) AS avg_delivery_days, 100.0 * SUM(CASE WHEN t1.delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*) AS pct_within_5_days FROM t1 GROUP BY t1.lane_group ), t3 AS ( SELECT COUNT(*) AS total_orders FROM t1 ) SELECT t2.lane_group AS lane_group, t2.orders_fully_delivered AS orders_fully_delivered, t2.avg_delivery_days AS avg_delivery_days, t2.pct_within_5_days AS pct_within_5_days, 100.0 * t2.orders_fully_delivered / t3.total_orders AS share_of_orders_pct FROM t2 CROSS JOIN t3 ORDER BY CASE t2.lane_group WHEN 'Lowlands core (NL/BE/FR)' THEN 1 WHEN 'Lowlands non-core (other countries)' THEN 2 ELSE 3 END NULLS LAST, t2.lane_group NULLS LAST
WITH t0 AS ( SELECT o.id AS order_id, o.placed_at AS placed_at, o.shipping_address_id AS shipping_address_id, s.carrier AS carrier, s.delivered_at AS delivered_at, (CAST(divideDecimal(toDecimal128(dateDiff('microsecond', o.placed_at, s.delivered_at), 0), toDecimal128(1000000, 0), 6) AS Nullable(Decimal(18, 6))) / 86400.0) AS delivery_days FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id WHERE o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND o.status = 'fulfilled' AND s.delivered_at IS NOT NULL AND (SELECT COUNT(*) FROM fulfillments f2 WHERE f2.order_id = o.id) = 1 AND (SELECT COUNT(*) FROM shipments s2 WHERE s2.fulfillment_id = f.id) = 1 ), t1 AS ( SELECT t0.order_id AS order_id, t0.delivery_days AS delivery_days, CASE WHEN t0.carrier = 'Lowlands Express' AND c.name IN ('Netherlands', 'Belgium', 'France') THEN 'Lowlands core (NL/BE/FR)' WHEN t0.carrier = 'Lowlands Express' THEN 'Lowlands non-core (other countries)' ELSE 'All other carriers' END AS lane_group FROM t0 LEFT JOIN addresses a ON a.id = t0.shipping_address_id LEFT JOIN countries c ON c.id = a.country_id ), t2 AS ( SELECT t1.lane_group AS lane_group, COUNT(*) AS orders_fully_delivered, AVG(t1.delivery_days) AS avg_delivery_days, 100.0 * SUM(CASE WHEN t1.delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*) AS pct_within_5_days FROM t1 GROUP BY t1.lane_group ), t3 AS ( SELECT COUNT(*) AS total_orders FROM t1 ) SELECT t2.lane_group AS lane_group, t2.orders_fully_delivered AS orders_fully_delivered, t2.avg_delivery_days AS avg_delivery_days, t2.pct_within_5_days AS pct_within_5_days, 100.0 * t2.orders_fully_delivered / t3.total_orders AS share_of_orders_pct FROM t2 CROSS JOIN t3 ORDER BY CASE t2.lane_group WHEN 'Lowlands core (NL/BE/FR)' THEN 1 WHEN 'Lowlands non-core (other countries)' THEN 2 ELSE 3 END NULLS LAST, t2.lane_group NULLS LAST
The agents' own records, as the role play wrote them; only the personal data of the person who ran it is redacted
Report request from Lena Hartmann (analyst for the Chief Operating Officer):
Title: Order-level delivery reliability: Lowlands Express by destination lane, 2025
Question: How much better would Lowlands Express's orders perform, and how much would that help overall, if we only used it on its strong home lanes (Netherlands, Belgium, France) and moved everything else off it?
Grain: one row per lane_group: 'Lowlands core (NL/BE/FR)', 'Lowlands non-core (other countries)', 'All other carriers'
Columns:
- lane_group
- orders_fully_delivered
- avg_delivery_days
- pct_within_5_days
- share_of_orders_pct
Details: Same scoping and single-carrier attribution rule as the other two reports in this set (orders placed_at in 2025, status='fulfilled', exactly one fulfillment with exactly one shipment, delivered_at not null). For orders where shipments.carrier = 'Lowlands Express', further split by the order's destination country (orders.shipping_address_id -> addresses -> countries): 'Lowlands core' if country in ('Netherlands','Belgium','France'), else 'Lowlands non-core'. All other orders (any other carrier) go to 'All other carriers'. Round avg_delivery_days to 2 decimals, pct columns to 1 decimal. Order: 'Lowlands core' first, then 'Lowlands non-core', then 'All other carriers'. Expect 3 rows.
Check your query with the warehouse's dry_run tool, then hand it in with submit.dry_runWITH t0 AS ( SELECT o.id AS order_id, o.placed_at, o.shipping_address_id, s.carrier, s.delivered_at, (EXTRACT(EPOCH FROM (s.delivered_at - o.placed_at)) / 86400.0) AS delivery_days FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id WHERE o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND o.status = 'fulfilled' AND s.delivered_at IS NOT NULL AND (SELECT COUNT(*) FROM fulfillments f2 WHERE f2.order_id = o.id) = 1 AND (SELECT COUNT(*) FROM shipments s2 WHERE s2.fulfillment_id = f.id) = 1 ), t1 AS ( SELECT t0.order_id, t0.delivery_days, CASE WHEN t0.carrier = 'Lowlands Express' AND c.name IN ('Netherlands', 'Belgium', 'France') THEN 'Lowlands core (NL/BE/FR)' WHEN t0.carrier = 'Lowlands Express' THEN 'Lowlands non-core (other countries)' ELSE 'All other carriers' END AS lane_group FROM t0 LEFT JOIN addresses a ON a.id = t0.shipping_address_id LEFT JOIN countries c ON c.id = a.country_id ), t2 AS ( SELECT t1.lane_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(t1.delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN t1.delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days FROM t1 GROUP BY t1.lane_group ), t3 AS ( SELECT COUNT(*) AS total_orders FROM t1 ) SELECT t2.lane_group, t2.orders_fully_delivered, t2.avg_delivery_days, t2.pct_within_5_days, ROUND(100.0 * t2.orders_fully_delivered / t3.total_orders, 1) AS share_of_orders_pct FROM t2 CROSS JOIN t3 ORDER BY CASE t2.lane_group WHEN 'Lowlands core (NL/BE/FR)' THEN 1 WHEN 'Lowlands non-core (other countries)' THEN 2 ELSE 3 END, t2.lane_group
STATUS: COMPILES (dry run on the empty schema, no data read) COLUMNS: lane_group, orders_fully_delivered, avg_delivery_days, pct_within_5_days, share_of_orders_pct
submitWITH t0 AS ( SELECT o.id AS order_id, o.placed_at, o.shipping_address_id, s.carrier, s.delivered_at, (EXTRACT(EPOCH FROM (s.delivered_at - o.placed_at)) / 86400.0) AS delivery_days FROM orders o JOIN fulfillments f ON f.order_id = o.id JOIN shipments s ON s.fulfillment_id = f.id WHERE o.placed_at >= DATE '2025-01-01' AND o.placed_at < DATE '2026-01-01' AND o.status = 'fulfilled' AND s.delivered_at IS NOT NULL AND (SELECT COUNT(*) FROM fulfillments f2 WHERE f2.order_id = o.id) = 1 AND (SELECT COUNT(*) FROM shipments s2 WHERE s2.fulfillment_id = f.id) = 1 ), t1 AS ( SELECT t0.order_id, t0.delivery_days, CASE WHEN t0.carrier = 'Lowlands Express' AND c.name IN ('Netherlands', 'Belgium', 'France') THEN 'Lowlands core (NL/BE/FR)' WHEN t0.carrier = 'Lowlands Express' THEN 'Lowlands non-core (other countries)' ELSE 'All other carriers' END AS lane_group FROM t0 LEFT JOIN addresses a ON a.id = t0.shipping_address_id LEFT JOIN countries c ON c.id = a.country_id ), t2 AS ( SELECT t1.lane_group, COUNT(*) AS orders_fully_delivered, ROUND(AVG(t1.delivery_days)::numeric, 2) AS avg_delivery_days, ROUND(100.0 * SUM(CASE WHEN t1.delivery_days <= 5 THEN 1 ELSE 0 END) / COUNT(*), 1) AS pct_within_5_days FROM t1 GROUP BY t1.lane_group ), t3 AS ( SELECT COUNT(*) AS total_orders FROM t1 ) SELECT t2.lane_group, t2.orders_fully_delivered, t2.avg_delivery_days, t2.pct_within_5_days, ROUND(100.0 * t2.orders_fully_delivered / t3.total_orders, 1) AS share_of_orders_pct FROM t2 CROSS JOIN t3 ORDER BY CASE t2.lane_group WHEN 'Lowlands core (NL/BE/FR)' THEN 1 WHEN 'Lowlands non-core (other countries)' THEN 2 ELSE 3 END, t2.lane_group
Submitted to tonight's batch. Your work on this request is done.