top_customers_by_spend
Identify top customers by total spend from non-cancelled orders, with optional date range filtering. Returns each customer's name, order count, and total amount spent.
Instructions
Top customers by total spend (sum of orders.total_amount), EXCLUDING cancelled orders. Optionally filter by a date range on order_date. Each row: { customer_id, name, orders, total_spent }. Default limit 10.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Only include orders with order_date <= this ISO date/datetime. | |
| from | No | Only include orders with order_date >= this ISO date/datetime. | |
| limit | No | Max customers to return. |