Skip to content
Datablare
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.

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

1 · The brief

What Claude Code was asked

Give me a customer view for the bank: how many customers we have and how many are active this year, monthly spend per active customer, active customers each month, value by city, and the risk mix in each city.

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

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

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 2025 – October 2026):

  • Customers: 3,000 (All segments)
  • Active this year: 2,277 (75.9% of customers)
  • Spend per active customer: ₹928 (Monthly, last six months)
  • High-risk customers: 8.1% (Share of customers)

What stands out:

  • Active customers per month: Between 1,703 and 1,775 customers use a card each month
  • Approved value by city, 2026: Bengaluru leads with ₹2.49M
  • Spend per active customer per month: Steady month to month
  • Customers by city and risk level: High-risk customers are spread across every city

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

    Customers, customers active in 2026, and the high-risk share

    1 row · 13,981 ms

    SELECT count(*) AS customers,
           count(*) FILTER (WHERE EXISTS (
             SELECT 1 FROM banking.cards c JOIN banking.transactions t ON t.card_id = c.id
             WHERE c.customer_id = cu.id AND t.ts >= TIMESTAMP '2026-01-01')) AS active_2026,
           round(avg(CASE WHEN risk_level = 'High' THEN 1.0 ELSE 0 END), 4) AS high_risk_share
    FROM banking.customers cu
  2. Query 2

    Active customers and approved spend per active customer, by month since January 2025

    22 rows · 452 ms

    SELECT to_char(date_trunc('month', t.ts), 'YYYY-MM') AS month, count(DISTINCT c.customer_id) AS active_customers,
           round(sum(t.amount) / count(DISTINCT c.customer_id), 0) AS spend_per_active_customer
    FROM banking.transactions t
    JOIN banking.cards c ON c.id = t.card_id
    WHERE t.status = 'approved'
    GROUP BY 1
    ORDER BY 1
  3. Query 3

    Approved value and customers by city, 2026

    7 rows · 153 ms

    SELECT cu.city, count(DISTINCT cu.id) AS customers, round(sum(t.amount), 0) AS value
    FROM banking.transactions t
    JOIN banking.cards c ON c.id = t.card_id
    JOIN banking.customers cu ON cu.id = c.customer_id
    WHERE t.ts >= TIMESTAMP '2026-01-01' AND t.status = 'approved'
    GROUP BY 1
    ORDER BY 3 DESC
  4. Query 4

    Customers by city and risk level

    21 rows · 115 ms

    SELECT city, risk_level, count(*) AS customers
    FROM banking.customers
    GROUP BY 1, 2
    ORDER BY 1, 2
Tables read banking.cardsbanking.customersbanking.transactions

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
Give me a customer view for the bank: how many customers we have and how many are active this year, monthly spend per active customer, active customers each month, value by city, and the risk mix in each city.
Intent
Customers, customers active in 2026, and the high-risk share
Result
4 queries, 51 rows, read-only

More use cases

All examples
  • Card transaction risk monitor dashboard: Transaction value per month, Failed rate by customer risk level, Failed rate by merchant category, Monthly failed rate
    Claude Code Banking Risk & compliance

    Card transaction risk monitor

    41,022 card transactions worth ₹16.73M, a 2.46% failure rate, and where failures concentrate by risk level and merchant.

    Updated Open

  • Card spending mix and portfolio dashboard: Spend by merchant category, Transactions by channel, Spend by card brand and type, Average ticket by segment
    Claude Code Banking Revenue & growth

    Card spending mix and portfolio

    4,184 active cards with a ₹405 average ticket; Travel leads spend and 33% of transactions are online.

    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]