Skip to content
Datablare
Claude Code Logistics Cost & spend

Freight spend and cost per kg

₹44.17M of freight this year at ₹1.8K a shipment; air is 33% of spend, and small parcels cost the most per kg.

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

1 · The brief

What Claude Code was asked

Where is our freight money going this year? Show total spend, cost per shipment and per kg, the air share of spend, monthly spend by mode, cost per kg by weight band, and the destinations we spend most on.

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

Freight spend and cost per kg dashboard: Spend per month by mode, Cost per kg by weight band, Spend by destination state

Built from 4 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):

  • Freight spend: ₹44.17M (2026 so far)
  • Cost per shipment: ₹1.8K (Average)
  • Cost per kg: ₹7.57 (All shipments)
  • Air share of spend: 32.8% (One carrier, a third of spend)

What stands out:

  • Spend per month by mode: Road carries most of the spend; air is the next largest
  • Cost per kg by weight band: Under 50 kg costs ₹72 a kg; 300 kg and over ₹4.72
  • Spend by destination state: Karnataka tops the list at ₹4.55M

The data is a synthetic freight 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

4 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

    Freight spend, cost per shipment, cost per kg and air share of spend, 2026

    1 row · 69 ms

    SELECT round(sum(s.cost), 0) AS spend, round(avg(s.cost), 0) AS cost_per_shipment,
           round(sum(s.cost) / sum(s.weight_kg), 2) AS cost_per_kg,
           round(sum(s.cost) FILTER (WHERE c.mode = 'Air') / sum(s.cost), 4) AS air_share_of_spend
    FROM logistics.shipments s
    JOIN logistics.carriers c ON c.id = s.carrier_id
    WHERE s.shipped_at >= TIMESTAMP '2026-01-01'
  2. Query 2

    Freight spend by mode and month, 2026

    30 rows · 114 ms

    SELECT to_char(date_trunc('month', s.shipped_at), 'YYYY-MM') AS month, c.mode, round(sum(s.cost), 0) AS spend
    FROM logistics.shipments s
    JOIN logistics.carriers c ON c.id = s.carrier_id
    WHERE s.shipped_at >= TIMESTAMP '2026-01-01'
    GROUP BY 1, 2
    ORDER BY 1, 2
  3. Query 3

    Cost per kg by shipment weight band, 2026

    4 rows · 86 ms

    SELECT CASE WHEN weight_kg < 50 THEN '1. Under 50 kg' WHEN weight_kg < 150 THEN '2. 50–150 kg'
                WHEN weight_kg < 300 THEN '3. 150–300 kg' ELSE '4. 300 kg and over' END AS weight_band,
           count(*) AS shipments, round(sum(cost) / sum(weight_kg), 2) AS cost_per_kg
    FROM logistics.shipments
    WHERE shipped_at >= TIMESTAMP '2026-01-01'
    GROUP BY 1
    ORDER BY 1
  4. Query 4

    Freight spend by destination state, 2026

    10 rows · 73 ms

    SELECT dest_state, round(sum(cost), 0) AS spend, count(*) AS shipments
    FROM logistics.shipments
    WHERE shipped_at >= TIMESTAMP '2026-01-01'
    GROUP BY 1
    ORDER BY 2 DESC
Tables read logistics.carrierslogistics.shipments

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
Where is our freight money going this year? Show total spend, cost per shipment and per kg, the air share of spend, monthly spend by mode, cost per kg by weight band, and the destinations we spend most on.
Intent
Freight spend, cost per shipment, cost per kg and air share of spend, 2026
Result
4 queries, 45 rows, read-only

More use cases

All examples
  • Carrier delivery performance dashboard: On-time rate by carrier, On-time rate per month, Lanes with the lowest on-time rate, Cost per kg by carrier
    Claude Code Logistics Operations

    Carrier delivery performance

    24,000 shipments, 80.2% on time and 46 hours from pickup to delivery on average, with on-time rate and cost by carrier and lane.

    Updated Open

  • Lost and returned shipments dashboard: Lost and returned rate by carrier, Exception rate by origin state, Lost and returned shipments per month
    Claude Code Logistics Risk & compliance

    Lost and returned shipments

    881 shipments lost and 948 returned this year, costing ₹3.33M; Coastal Freight loses about twice as many as other carriers.

    Updated Open

  • E-commerce sales and retention dashboard dashboard: Monthly revenue, Revenue by category, 2026, Lifetime revenue per customer, by channel, Orders per month
    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.

    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]