{
  "id": "ecom",
  "order": 2,
  "title": "Which customers and products earn the money?",
  "kicker": "E-commerce \u00b7 Wholesale Gifts",
  "roles": [
    "E-commerce Ops",
    "DTC",
    "Merchandising",
    "Marketing Analyst"
  ],
  "question": "Which customers and products actually drive revenue, and where is money leaking to returns and one-time buyers?",
  "source": {
    "name": "UCI Online Retail II",
    "url": "https://archive.ics.uci.edu/dataset/502/online+retail+ii",
    "license": "CC BY 4.0",
    "publisher": "Chen, D. (2012), UCI Machine Learning Repository",
    "as_of": "December 2011",
    "rows_raw": 1067371,
    "rows_used": 1021254,
    "caveat": "This is a real UK-based online gift retailer selling mostly to wholesale customers, not a typical consumer DTC shop, so basket sizes and repeat-purchase patterns skew larger and more B2B than a typical online store."
  },
  "cleaning": [
    "Dropped non-product stock codes (POST, DOT, M, m, D, BANK CHARGES, AMAZONFEE, C2, PADS, CRUK, ADJUST, ADJUST2, S, B, TEST001/002, gift card vouchers) that represent postage, fees, manual adjustments, and test rows rather than real merchandise.",
    "Dropped rows with price <= 0 (6,207 rows); nearly all of these have no Customer ID and are internal stock corrections, not customer sales.",
    "Dropped negative-quantity rows on invoices that do not start with 'C' (3,457 rows); a true return in this dataset is a cancellation invoice (prefix 'C'), and these unlabeled negative-quantity rows all have null Customer ID and mostly null description, so they read as inventory write-offs rather than customer returns.",
    "Removed 34,035 exact duplicate line items (after the rules above).",
    "Kept rows with missing Customer ID (22.2% of clean rows) for revenue and product analysis since they are real sales; excluded them from the cohort retention analysis, which requires a known customer.",
    "Published table covers Dec 2010 to Dec 2011 (13 months) at invoice-line level to stay under the file size cap; the monthly revenue and cohort retention charts use the full Dec 2009 to Dec 2011 history, computed in the prep script and pre-aggregated into the chart data."
  ],
  "kpis": [
    {
      "label": "Total net revenue",
      "value": "\u00a318.9M",
      "note": "net of cancellations, Dec 2009 to Dec 2011"
    },
    {
      "label": "Cancellation rate",
      "value": "15.8%",
      "note": "of orders (3.6% of gross revenue)"
    },
    {
      "label": "One-time buyers",
      "value": "27.6%",
      "note": "of 5,852 identified customers bought only once"
    },
    {
      "label": "Top 20% of products",
      "value": "78.5%",
      "note": "share of total net revenue"
    }
  ],
  "filters": [
    {
      "id": "country_group",
      "label": "Country",
      "options": [
        "All",
        "UK",
        "International"
      ]
    }
  ],
  "charts": [
    {
      "id": "monthly_revenue",
      "kind": "line",
      "title": "Monthly net revenue, UK vs international",
      "subtitle": "November is the strongest month both years (holiday ordering); UK dwarfs international volume throughout.",
      "x": "month",
      "y": "net_revenue",
      "color": "country_group",
      "x_label": "Month",
      "y_label": "Net revenue",
      "format_y": "\u00a3",
      "filter_fields": [
        "country_group"
      ],
      "data": [
        {
          "month": "2009-12",
          "country_group": "International",
          "net_revenue": 68819.27
        },
        {
          "month": "2009-12",
          "country_group": "UK",
          "net_revenue": 709523.81
        },
        {
          "month": "2010-01",
          "country_group": "International",
          "net_revenue": 127930.19
        },
        {
          "month": "2010-01",
          "country_group": "UK",
          "net_revenue": 476901.6
        },
        {
          "month": "2010-02",
          "country_group": "International",
          "net_revenue": 86974.67
        },
        {
          "month": "2010-02",
          "country_group": "UK",
          "net_revenue": 438359.56
        },
        {
          "month": "2010-03",
          "country_group": "International",
          "net_revenue": 92000.45
        },
        {
          "month": "2010-03",
          "country_group": "UK",
          "net_revenue": 660101.68
        },
        {
          "month": "2010-04",
          "country_group": "International",
          "net_revenue": 90117.2
        },
        {
          "month": "2010-04",
          "country_group": "UK",
          "net_revenue": 546198.47
        },
        {
          "month": "2010-05",
          "country_group": "International",
          "net_revenue": 91255.29
        },
        {
          "month": "2010-05",
          "country_group": "UK",
          "net_revenue": 515043.85
        },
        {
          "month": "2010-06",
          "country_group": "International",
          "net_revenue": 94716.28
        },
        {
          "month": "2010-06",
          "country_group": "UK",
          "net_revenue": 575530.05
        },
        {
          "month": "2010-07",
          "country_group": "International",
          "net_revenue": 80203.95
        },
        {
          "month": "2010-07",
          "country_group": "UK",
          "net_revenue": 535657.64
        },
        {
          "month": "2010-08",
          "country_group": "International",
          "net_revenue": 92899.87
        },
        {
          "month": "2010-08",
          "country_group": "UK",
          "net_revenue": 568740.25
        },
        {
          "month": "2010-09",
          "country_group": "International",
          "net_revenue": 125279.44
        },
        {
          "month": "2010-09",
          "country_group": "UK",
          "net_revenue": 716277.26
        },
        {
          "month": "2010-10",
          "country_group": "International",
          "net_revenue": 143920.0
        },
        {
          "month": "2010-10",
          "country_group": "UK",
          "net_revenue": 925064.91
        },
        {
          "month": "2010-11",
          "country_group": "International",
          "net_revenue": 174448.71
        },
        {
          "month": "2010-11",
          "country_group": "UK",
          "net_revenue": 1220153.09
        },
        {
          "month": "2010-12",
          "country_group": "International",
          "net_revenue": 67160.75
        },
        {
          "month": "2010-12",
          "country_group": "UK",
          "net_revenue": 690929.75
        },
        {
          "month": "2011-01",
          "country_group": "International",
          "net_revenue": 123130.01
        },
        {
          "month": "2011-01",
          "country_group": "UK",
          "net_revenue": 455725.18
        },
        {
          "month": "2011-02",
          "country_group": "International",
          "net_revenue": 86560.24
        },
        {
          "month": "2011-02",
          "country_group": "UK",
          "net_revenue": 412904.11
        },
        {
          "month": "2011-03",
          "country_group": "International",
          "net_revenue": 117426.06
        },
        {
          "month": "2011-03",
          "country_group": "UK",
          "net_revenue": 561903.15
        },
        {
          "month": "2011-04",
          "country_group": "International",
          "net_revenue": 47309.08
        },
        {
          "month": "2011-04",
          "country_group": "UK",
          "net_revenue": 434752.85
        },
        {
          "month": "2011-05",
          "country_group": "International",
          "net_revenue": 121384.71
        },
        {
          "month": "2011-05",
          "country_group": "UK",
          "net_revenue": 609620.06
        },
        {
          "month": "2011-06",
          "country_group": "International",
          "net_revenue": 130700.79
        },
        {
          "month": "2011-06",
          "country_group": "UK",
          "net_revenue": 593144.35
        },
        {
          "month": "2011-07",
          "country_group": "International",
          "net_revenue": 110225.68
        },
        {
          "month": "2011-07",
          "country_group": "UK",
          "net_revenue": 566586.4
        },
        {
          "month": "2011-08",
          "country_group": "International",
          "net_revenue": 139865.25
        },
        {
          "month": "2011-08",
          "country_group": "UK",
          "net_revenue": 561424.68
        },
        {
          "month": "2011-09",
          "country_group": "International",
          "net_revenue": 151120.77
        },
        {
          "month": "2011-09",
          "country_group": "UK",
          "net_revenue": 860218.97
        },
        {
          "month": "2011-10",
          "country_group": "International",
          "net_revenue": 184774.78
        },
        {
          "month": "2011-10",
          "country_group": "UK",
          "net_revenue": 876926.44
        },
        {
          "month": "2011-11",
          "country_group": "International",
          "net_revenue": 168216.66
        },
        {
          "month": "2011-11",
          "country_group": "UK",
          "net_revenue": 1258907.88
        },
        {
          "month": "2011-12",
          "country_group": "International",
          "net_revenue": 42053.02
        },
        {
          "month": "2011-12",
          "country_group": "UK",
          "net_revenue": 398346.54
        }
      ]
    },
    {
      "id": "cohort_retention",
      "kind": "heatmap",
      "title": "Customer cohort retention",
      "subtitle": "At month 3, 9.5% to 42.5% of a cohort is still buying; the average across the 12 cohorts is 23.3% at month 3 and 19.6% at month 12.",
      "x": "months_since",
      "y": "cohort_month",
      "color": "retention_pct",
      "x_label": "Months since first purchase",
      "y_label": "First-purchase cohort",
      "format_y": "%",
      "filter_fields": [],
      "data": [
        {
          "cohort_month": "2009-12",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 1,
          "retention_pct": 35.0,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 2,
          "retention_pct": 33.3,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 3,
          "retention_pct": 42.5,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 4,
          "retention_pct": 37.9,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 5,
          "retention_pct": 36.0,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 6,
          "retention_pct": 37.6,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 7,
          "retention_pct": 34.4,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 8,
          "retention_pct": 33.8,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 9,
          "retention_pct": 36.2,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 10,
          "retention_pct": 42.2,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 11,
          "retention_pct": 49.6,
          "cohort_size": 951
        },
        {
          "cohort_month": "2009-12",
          "months_since": 12,
          "retention_pct": 37.6,
          "cohort_size": 951
        },
        {
          "cohort_month": "2010-01",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 1,
          "retention_pct": 21.5,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 2,
          "retention_pct": 32.1,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 3,
          "retention_pct": 31.5,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 4,
          "retention_pct": 27.2,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 5,
          "retention_pct": 31.0,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 6,
          "retention_pct": 26.9,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 7,
          "retention_pct": 23.4,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 8,
          "retention_pct": 28.5,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 9,
          "retention_pct": 32.6,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 10,
          "retention_pct": 31.0,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 11,
          "retention_pct": 17.9,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-01",
          "months_since": 12,
          "retention_pct": 22.8,
          "cohort_size": 368
        },
        {
          "cohort_month": "2010-02",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 1,
          "retention_pct": 23.5,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 2,
          "retention_pct": 22.7,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 3,
          "retention_pct": 29.3,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 4,
          "retention_pct": 24.5,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 5,
          "retention_pct": 19.7,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 6,
          "retention_pct": 19.2,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 7,
          "retention_pct": 28.8,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 8,
          "retention_pct": 25.6,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 9,
          "retention_pct": 27.7,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 10,
          "retention_pct": 11.5,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 11,
          "retention_pct": 12.5,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-02",
          "months_since": 12,
          "retention_pct": 15.2,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-03",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 1,
          "retention_pct": 19.0,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 2,
          "retention_pct": 23.1,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 3,
          "retention_pct": 24.3,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 4,
          "retention_pct": 23.1,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 5,
          "retention_pct": 20.4,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 6,
          "retention_pct": 24.7,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 7,
          "retention_pct": 30.6,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 8,
          "retention_pct": 27.7,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 9,
          "retention_pct": 10.9,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 10,
          "retention_pct": 11.6,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 11,
          "retention_pct": 14.5,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-03",
          "months_since": 12,
          "retention_pct": 20.0,
          "cohort_size": 441
        },
        {
          "cohort_month": "2010-04",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 1,
          "retention_pct": 19.0,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 2,
          "retention_pct": 19.0,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 3,
          "retention_pct": 16.0,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 4,
          "retention_pct": 18.4,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 5,
          "retention_pct": 22.1,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 6,
          "retention_pct": 27.6,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 7,
          "retention_pct": 26.5,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 8,
          "retention_pct": 10.5,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 9,
          "retention_pct": 10.9,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 10,
          "retention_pct": 7.5,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 11,
          "retention_pct": 13.9,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-04",
          "months_since": 12,
          "retention_pct": 14.3,
          "cohort_size": 294
        },
        {
          "cohort_month": "2010-05",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 1,
          "retention_pct": 15.7,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 2,
          "retention_pct": 16.9,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 3,
          "retention_pct": 17.6,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 4,
          "retention_pct": 17.6,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 5,
          "retention_pct": 25.5,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 6,
          "retention_pct": 21.2,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 7,
          "retention_pct": 12.5,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 8,
          "retention_pct": 5.9,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 9,
          "retention_pct": 8.2,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 10,
          "retention_pct": 11.4,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 11,
          "retention_pct": 13.3,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-05",
          "months_since": 12,
          "retention_pct": 15.3,
          "cohort_size": 255
        },
        {
          "cohort_month": "2010-06",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 1,
          "retention_pct": 17.6,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 2,
          "retention_pct": 18.7,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 3,
          "retention_pct": 20.6,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 4,
          "retention_pct": 23.2,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 5,
          "retention_pct": 28.5,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 6,
          "retention_pct": 12.7,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 7,
          "retention_pct": 9.0,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 8,
          "retention_pct": 8.2,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 9,
          "retention_pct": 11.2,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 10,
          "retention_pct": 10.5,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 11,
          "retention_pct": 13.9,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-06",
          "months_since": 12,
          "retention_pct": 15.0,
          "cohort_size": 267
        },
        {
          "cohort_month": "2010-07",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 1,
          "retention_pct": 15.7,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 2,
          "retention_pct": 18.4,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 3,
          "retention_pct": 29.7,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 4,
          "retention_pct": 29.2,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 5,
          "retention_pct": 14.1,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 6,
          "retention_pct": 11.4,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 7,
          "retention_pct": 14.6,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 8,
          "retention_pct": 14.6,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 9,
          "retention_pct": 11.4,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 10,
          "retention_pct": 13.5,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 11,
          "retention_pct": 14.6,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-07",
          "months_since": 12,
          "retention_pct": 13.0,
          "cohort_size": 185
        },
        {
          "cohort_month": "2010-08",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 1,
          "retention_pct": 19.6,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 2,
          "retention_pct": 28.8,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 3,
          "retention_pct": 32.5,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 4,
          "retention_pct": 16.6,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 5,
          "retention_pct": 11.7,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 6,
          "retention_pct": 9.8,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 7,
          "retention_pct": 12.9,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 8,
          "retention_pct": 13.5,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 9,
          "retention_pct": 12.9,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 10,
          "retention_pct": 12.9,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 11,
          "retention_pct": 11.7,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-08",
          "months_since": 12,
          "retention_pct": 14.7,
          "cohort_size": 163
        },
        {
          "cohort_month": "2010-09",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 1,
          "retention_pct": 23.0,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 2,
          "retention_pct": 23.4,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 3,
          "retention_pct": 13.0,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 4,
          "retention_pct": 8.8,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 5,
          "retention_pct": 10.5,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 6,
          "retention_pct": 13.8,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 7,
          "retention_pct": 9.6,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 8,
          "retention_pct": 13.0,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 9,
          "retention_pct": 13.0,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 10,
          "retention_pct": 12.1,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 11,
          "retention_pct": 10.0,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-09",
          "months_since": 12,
          "retention_pct": 22.6,
          "cohort_size": 239
        },
        {
          "cohort_month": "2010-10",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 1,
          "retention_pct": 25.9,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 2,
          "retention_pct": 14.7,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 3,
          "retention_pct": 12.5,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 4,
          "retention_pct": 8.8,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 5,
          "retention_pct": 8.3,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 6,
          "retention_pct": 13.1,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 7,
          "retention_pct": 13.9,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 8,
          "retention_pct": 10.7,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 9,
          "retention_pct": 9.3,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 10,
          "retention_pct": 10.7,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 11,
          "retention_pct": 12.8,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-10",
          "months_since": 12,
          "retention_pct": 19.2,
          "cohort_size": 375
        },
        {
          "cohort_month": "2010-11",
          "months_since": 0,
          "retention_pct": 100.0,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 1,
          "retention_pct": 17.5,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 2,
          "retention_pct": 9.5,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 3,
          "retention_pct": 9.5,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 4,
          "retention_pct": 7.7,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 5,
          "retention_pct": 8.9,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 6,
          "retention_pct": 12.9,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 7,
          "retention_pct": 10.1,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 8,
          "retention_pct": 8.6,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 9,
          "retention_pct": 9.2,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 10,
          "retention_pct": 11.0,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 11,
          "retention_pct": 14.7,
          "cohort_size": 326
        },
        {
          "cohort_month": "2010-11",
          "months_since": 12,
          "retention_pct": 25.2,
          "cohort_size": 326
        }
      ]
    },
    {
      "id": "product_pareto",
      "kind": "bar",
      "title": "Revenue concentration across products",
      "subtitle": "The top 10% of SKUs by revenue generate most of the money; the bottom 40% barely register.",
      "x": "sku_decile",
      "y": "cumulative_revenue_pct",
      "color": null,
      "x_label": "Product decile (1 = top 10% by revenue)",
      "y_label": "Cumulative % of revenue",
      "format_y": "%",
      "filter_fields": [],
      "data": [
        {
          "sku_decile": 1,
          "decile_revenue": 11792519.419999978,
          "cumulative_revenue_pct": 62.3
        },
        {
          "sku_decile": 2,
          "decile_revenue": 3072605.949999997,
          "cumulative_revenue_pct": 78.5
        },
        {
          "sku_decile": 3,
          "decile_revenue": 1640235.6199999994,
          "cumulative_revenue_pct": 87.2
        },
        {
          "sku_decile": 4,
          "decile_revenue": 991813.8999999998,
          "cumulative_revenue_pct": 92.4
        },
        {
          "sku_decile": 5,
          "decile_revenue": 623835.7399999999,
          "cumulative_revenue_pct": 95.7
        },
        {
          "sku_decile": 6,
          "decile_revenue": 400582.3999999996,
          "cumulative_revenue_pct": 97.9
        },
        {
          "sku_decile": 7,
          "decile_revenue": 240647.66000000018,
          "cumulative_revenue_pct": 99.1
        },
        {
          "sku_decile": 8,
          "decile_revenue": 115863.43999999996,
          "cumulative_revenue_pct": 99.7
        },
        {
          "sku_decile": 9,
          "decile_revenue": 42385.51999999999,
          "cumulative_revenue_pct": 100.0
        },
        {
          "sku_decile": 10,
          "decile_revenue": 6945.999999999988,
          "cumulative_revenue_pct": 100.0
        }
      ]
    },
    {
      "id": "cancellation_impact",
      "kind": "bar",
      "title": "Cancellations: share of orders vs share of revenue",
      "subtitle": "Definition: % of invoices that are cancellations vs cancelled revenue as a % of gross revenue, UK vs International, Dec 2009 to Dec 2011. Cancellations hit 15-20% of orders but only 3-4% of revenue in both groups, so the leak is mostly handling cost, not lost revenue.",
      "x": "country_group",
      "y": "value_pct",
      "color": "measure",
      "x_label": "Country group",
      "y_label": "Share",
      "format_y": "%",
      "filter_fields": [],
      "data": [
        {
          "country_group": "International",
          "measure": "Share of orders cancelled",
          "value_pct": 19.6
        },
        {
          "country_group": "International",
          "measure": "Share of gross revenue cancelled",
          "value_pct": 3.0
        },
        {
          "country_group": "UK",
          "measure": "Share of orders cancelled",
          "value_pct": 15.4
        },
        {
          "country_group": "UK",
          "measure": "Share of gross revenue cancelled",
          "value_pct": 3.8
        }
      ]
    }
  ],
  "finding": "The top 20% of products by revenue generate 78.5% of total net revenue (the top 10% alone generate 62.3%), while the bottom 30% of SKUs contribute under 1% (0.9%). 27.6% of identified customers bought only once, and cohorts that do return settle around a 23.3% average month-3 repeat-purchase rate. Cancellations touch 15.8% of orders but only 3.6% of gross revenue, and that pattern holds in both the UK and international segments, so the leak is operational noise more than lost revenue.",
  "recommendation": "Protect stock and marketing budget for the top revenue-driving decile of SKUs first, and review the long tail of near-zero-revenue products for delisting. Build a second-purchase win-back flow targeted at first-time buyers, since over a quarter never come back. Track cancellation handling cost as an operations metric rather than treating it as a revenue-loss problem, since it runs 3 to 4% of revenue in every segment measured.",
  "in_role": "As an e-commerce or marketing analyst, I would turn the cohort and Pareto charts into a recurring monthly report, not a one-off pull. I have run my own affiliate and SEO e-commerce site since 2023 using GA4, Search Console, and SQL, so I am used to tracking which products and traffic actually convert versus which just take up catalog space. At Dasalla I identified $300,000 in non-performing inventory through data analysis and presented it to leadership, and I would apply that same instinct to the one-time-buyer gap here.",
  "method_sql": "WITH prod_rev AS (\n    SELECT stock_code, sum(line_revenue) AS rev\n    FROM retail_orders\n    GROUP BY 1\n),\nranked AS (\n    SELECT rev, ntile(5) OVER (ORDER BY rev DESC) AS quintile\n    FROM prod_rev\n)\nSELECT quintile, count(*) AS n_products, round(sum(rev), 2) AS revenue,\n       round(100.0 * sum(rev) / sum(sum(rev)) OVER (), 1) AS pct_of_total_revenue\nFROM ranked\nGROUP BY 1\nORDER BY 1",
  "table": {
    "name": "retail_orders",
    "file": "ecom.parquet",
    "rows": 531205,
    "columns": [
      {
        "name": "invoice",
        "type": "VARCHAR",
        "desc": "Invoice number; cancellations start with 'C'"
      },
      {
        "name": "stock_code",
        "type": "VARCHAR",
        "desc": "Product code"
      },
      {
        "name": "quantity",
        "type": "INTEGER",
        "desc": "Units sold (negative for cancellations)"
      },
      {
        "name": "invoice_date",
        "type": "DATE",
        "desc": "Date of the invoice line"
      },
      {
        "name": "price",
        "type": "FLOAT",
        "desc": "Unit price in British pounds (GBP, \u00a3)"
      },
      {
        "name": "customer_id",
        "type": "INTEGER",
        "desc": "Customer identifier; null for unidentified/guest orders"
      },
      {
        "name": "country",
        "type": "VARCHAR",
        "desc": "Customer country"
      },
      {
        "name": "is_cancelled",
        "type": "BOOLEAN",
        "desc": "True if invoice is a cancellation (starts with 'C')"
      },
      {
        "name": "line_revenue",
        "type": "FLOAT",
        "desc": "quantity * price in British pounds (GBP, \u00a3), negative for cancellations"
      }
    ]
  },
  "sample_queries": [
    {
      "label": "Monthly net revenue",
      "sql": "SELECT strftime(date_trunc('month', invoice_date), '%Y-%m') AS month, round(sum(line_revenue),2) AS net_revenue FROM retail_orders GROUP BY 1 ORDER BY 1"
    },
    {
      "label": "Top 10 products by net revenue",
      "sql": "SELECT stock_code, round(sum(line_revenue),2) AS net_revenue, count(*) AS line_items FROM retail_orders GROUP BY 1 ORDER BY 2 DESC LIMIT 10"
    },
    {
      "label": "Order cancellation rate, top 10 countries",
      "sql": "SELECT country, round(100.0*count(distinct CASE WHEN is_cancelled THEN invoice END)/count(distinct invoice),1) AS pct_orders_cancelled, count(distinct invoice) AS n_invoices FROM retail_orders GROUP BY 1 ORDER BY n_invoices DESC LIMIT 10"
    }
  ]
}