top_products
Rank products by units sold or revenue from completed and shipped orders, using actual sale prices to compute revenue. Returns product names, units sold, and revenue for informed inventory and sales analysis.
Instructions
Rank products by units sold (metric='units', default) or by revenue (metric='revenue'). Only 'completed' and 'shipped' orders count. Money is computed from order_items.unit_price (the actual sale price), not the current products.price. Returns a list of {name, units_sold, revenue}. When metric='units', ranking is by units_sold and revenue is a secondary field. limit defaults to 100 (max 1000); offset paginates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| metric | No | units | |
| offset | No |