Top Customers Analytics
fortnox_top_customersRank customers by total revenue, invoice count, unpaid balance, or average invoice size for any period to identify your top clients.
Instructions
Identify top customers by various metrics.
Answers questions like:
"Who are my top 10 customers by revenue?"
"Which customers have the most invoices?"
"Who has the highest unpaid balance?"
"What's the average invoice size per customer?"
Args:
metric ('total_amount' | 'invoice_count' | 'unpaid_amount' | 'average_invoice'): How to rank customers (default: total_amount)
period ('today' | ... | 'last_year'): Date period to analyze
from_date (string): Start date YYYY-MM-DD (ignored if period specified)
to_date (string): End date YYYY-MM-DD (ignored if period specified)
top_n (number): Number of customers to return, 1-50 (default: 10)
include_details (boolean): Include invoice breakdown per customer (default: false)
response_format ('markdown' | 'json'): Output format
Returns: For JSON: { metric, period, customers: [{ rank, customer_number, customer_name, value, invoice_count, ... }] } For Markdown: Ranked table of top customers
Examples:
Top 10 by revenue this year: period="this_year", top_n=10
Customers with most unpaid: metric="unpaid_amount"
Top 5 by invoice count last month: metric="invoice_count", period="last_month", top_n=5
Error Handling:
Returns truncation warning if >10,000 invoices analyzed
Returns "Error: ..." if API call fails
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_n | No | Number of top customers to return (1-50) | |
| metric | No | Metric to rank customers by | total_amount |
| period | No | Date period to analyze (e.g., 'this_year', 'last_month') | |
| to_date | No | End date for analysis (YYYY-MM-DD). Ignored if period is specified. | |
| from_date | No | Start date for analysis (YYYY-MM-DD). Ignored if period is specified. | |
| include_details | No | Include invoice breakdown for each customer | |
| response_format | No | Output format: 'markdown' or 'json' | markdown |