top_customers
Rank customers by total spend or order count. Use by='spend' to sum revenue from completed and shipped orders, or by='order_count' to count non-cancelled orders.
Instructions
Rank customers either by total spend or by number of placed orders.
by='spend': sums orders.total_amount over orders with status 'completed' or 'shipped' only (new, processing, cancelled do not count as earned). Returns first_name, last_name, email, total_spend.
by='order_count': counts orders whose status is NOT 'cancelled'. Returns first_name, last_name, email, order_count. Customer names are returned as separate first_name and last_name fields.
limitdefaults to 100 (max 1000);offsetpaginates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | No | spend | |
| limit | No | ||
| offset | No |