Skip to content
Datablare
Claude Code E-commerce Executive overview

E-commerce sales and retention dashboard

₹5.21M revenue from 11,897 orders this year, a 57.9% repeat-customer rate, and which channels bring the customers who spend most.

Data
Synthetic e-commerce demo data (PostgreSQL)
Asked in
Claude Code
Updated
Try this on your data

1 · The brief

What Claude Code was asked

Build me a sales dashboard for the store: revenue, orders and average order value this year, the monthly revenue trend, revenue by category, which acquisition channel brings the customers who spend the most, and how many customers come back to buy again.

Given exactly like this. Claude Code asked Datablare which tables it could read, wrote the SQL itself, ran each query through Datablare and built the dashboard from what came back.

2 · The dashboard

The dashboard Claude Code built

E-commerce sales and retention dashboard dashboard: Monthly revenue, Revenue by category, 2026, Lifetime revenue per customer, by channel, Orders per month

Built from 5 read-only queries. Every figure on the dashboard was read from the database through Datablare; nothing was estimated or typed in.

Headline numbers (January–October 2026):

  • Revenue: ₹5.21M (Completed orders, 2026)
  • Orders: 11,897 (6,258 customers)
  • Average order value: ₹438 (Completed orders)
  • Repeat customers: 57.9% (2.61 orders each on average)

What stands out:

  • Monthly revenue: Peak month: Aug ’26 at ₹580.8K
  • Revenue by category, 2026: Electronics leads with 39.8% of revenue
  • Lifetime revenue per customer, by channel: Referral customers spend ₹2.4K; Paid social ₹782
  • Orders per month: 22,550 completed orders since January 2025

The data is a synthetic e-commerce dataset made for this example, so the numbers describe no real company. The queries, the dashboard and the audit entries are real: Claude reached the database only through Datablare, read-only, and every query is on record with the question it served.

3 · What Datablare ran

5 read-only queries, nothing changed

Each query below is copied from the audit log of this run. Datablare checked that it only reads, ran it read-only, and gave only the rows to Claude Code; it never stores them.

  1. Query 1

    Headline numbers for completed orders in 2026 so far

    1 row · 101 ms

    SELECT count(*) AS orders, round(sum(total), 0) AS revenue, round(avg(total), 2) AS avg_order_value, count(DISTINCT customer_id) AS customers
    FROM ecommerce.orders
    WHERE status = 'completed' AND order_date >= DATE '2026-01-01'
  2. Query 2

    Monthly revenue and orders since January 2025, completed orders only

    22 rows · 288 ms

    SELECT to_char(date_trunc('month', order_date), 'YYYY-MM') AS month, round(sum(total), 0) AS revenue, count(*) AS orders
    FROM ecommerce.orders
    WHERE status = 'completed' AND order_date >= DATE '2025-01-01'
    GROUP BY 1
    ORDER BY 1
  3. Query 3

    Revenue by product category for 2026, from order lines of completed orders

    6 rows · 363 ms

    SELECT p.category, round(sum(i.quantity * i.unit_price), 0) AS revenue
    FROM ecommerce.order_items i
    JOIN ecommerce.orders o ON o.id = i.order_id
    JOIN ecommerce.products p ON p.id = i.product_id
    WHERE o.status = 'completed' AND o.order_date >= DATE '2026-01-01'
    GROUP BY 1
    ORDER BY 2 DESC
  4. Query 4

    Lifetime revenue per customer by acquisition channel

    6 rows · 164 ms

    SELECT c.channel, count(DISTINCT c.id) AS customers, round(sum(o.total) / count(DISTINCT c.id), 2) AS revenue_per_customer
    FROM ecommerce.customers c
    JOIN ecommerce.orders o ON o.customer_id = c.id AND o.status = 'completed'
    GROUP BY 1
    ORDER BY 3 DESC
  5. Query 5

    Share of buying customers with two or more completed orders

    1 row · 58 ms

    WITH per_customer AS (
      SELECT customer_id, count(*) AS n FROM ecommerce.orders WHERE status = 'completed' GROUP BY 1
    )
    SELECT round(count(*) FILTER (WHERE n >= 2)::numeric / count(*), 4) AS repeat_rate, count(*) AS buying_customers, round(avg(n), 2) AS avg_orders_per_customer
    FROM per_customer
Tables read ecommerce.customersecommerce.order_itemsecommerce.ordersecommerce.products

4 · The audit entry

Who asked what, on record

Every query is recorded with the person who asked, the question in their words and why the agent ran it. Admins see this in the audit log; nothing reaches the database without it.

How the audit log works

query_data_source

via Claude Code

Allowed
Who
The person signed in (hidden on this public page)
Question
Build me a sales dashboard for the store: revenue, orders and average order value this year, the monthly revenue trend, revenue by category, which acquisition channel brings the customers who spend the most, and how many customers come back to buy again.
Intent
Headline numbers for completed orders in 2026 so far
Result
5 queries, 36 rows, read-only

More use cases

All examples
  • Product performance and returns dashboard: Top ten products by revenue, Return rate by category, Return and cancellation rates per month
    Claude Code E-commerce Product & marketing

    Product performance and returns

    41,246 units sold this year with a 9.6% return rate; Footwear and Apparel are returned most, and Classic Headphones leads revenue.

    Updated Open

  • Customer retention by first-order cohort dashboard: New and returning revenue per month, Back for a second order, by first-order quarter, New customers per quarter
    Claude Code E-commerce Customer analytics

    Customer retention by first-order cohort

    2,856 new customers this year, 76.1% of revenue from returning customers, and a median 139 days to a second order.

    Updated Open

  • Customer activity by city and segment dashboard: Active customers per month, Approved value by city, 2026, Spend per active customer per month, Customers by city and risk level
    Claude Code Banking Customer analytics

    Customer activity by city and segment

    2,277 of 3,000 customers active this year, spend per active customer each month, value by city, and the risk mix in each city.

    Updated Open

Build this on your own data.

Connect your database, choose the tables Claude may read, and give it the same brief. Claude is connected in about two minutes.

30 minutes with the founder. Or WhatsApp / [email protected]