How to use AI to analyze three months of your own sales data and tell you which products or services are actually making you money
Use AI to analyze sales data for your small business: upload a CSV to ChatGPT or Claude and get a ranked profitability table in under 2 hours.
Most small business owners know their revenue number. Almost none know which products or services are actually making them money. This post walks you through how to use AI to analyze sales data for your small business — uploading three months of figures to ChatGPT{:target="_blank"} or Claude{:target="_blank"} and getting a ranked profitability table you can act on. It works because these tools can run real calculations on your actual data — not estimates, not averages from someone else's business.
What you need before you start
ChatGPT (GPT-4o) with Advanced Data Analysis: This is the file-upload and calculation feature inside ChatGPT. It processes your spreadsheet directly and runs Python in the background — you never touch the code. Requires a ChatGPT Plus subscription. Check OpenAI's pricing page{:target="_blank"} for current rates. Claude 3.7 Sonnet also handles file uploads and works well if you prefer it; some users find its explanations easier to read.
Time required: 1–2 hours for the first run (includes export, cleaning, and analysis). Roughly 20–30 minutes once you've done it once.
Skill level: No coding required. You need basic comfort with exporting a report from your sales platform and editing a spreadsheet.
Why your revenue report is lying to you
Your top-line revenue report ranks products by how much money came in. That number tells you what customers bought. It does not tell you what you kept.
A product generating $10,000 in revenue at a 10% margin contributes $1,000 in gross profit. A product generating $3,000 at 60% margin contributes $1,800. Every standard sales report buries this. A Salesforce SMB Trends report{:target="_blank"} found that fewer than 20% of small businesses with under 10 employees have anyone formally reviewing profitability by product line. That means most owners are optimizing for the wrong number.
Gross margin is the metric that matters. Revenue minus cost of goods sold, divided by revenue. That's what this analysis will calculate.
What data you need — and how to export it in under 5 minutes
You need a CSV file with these columns at minimum: date, product or service name, quantity sold, revenue per line item, and cost per line item (COGS).
Most platforms export this in a few clicks:
- Open your sales platform — Shopify{:target="_blank"}, Square{:target="_blank"}, QuickBooks{:target="_blank"}, or WooCommerce{:target="_blank"}.
- Navigate to Reports, then Sales by Product or similar.
- Set the date range to the last 90 days.
- Click Export and select CSV format. You should see a file download to your computer.
If your export includes COGS, you're ready to move to cleaning. If it doesn't — which is common — note that now. You'll handle it in the next section.
A 90-day window smooths out weekly noise. It also captures at least one full billing cycle or promotion period while still reflecting your current pricing and product mix.
How to clean and prep your CSV so the AI doesn't misread it
A messy file produces a messy analysis. Four things to fix before you upload:
- Open your CSV in Google Sheets{:target="_blank"} or Excel.
- Delete any summary rows, subtotals, or blank rows. The AI reads every row as a data point. A subtotal row will double-count revenue.
- Check that refunded orders are either removed or flagged in a separate column. Mixed refunds and completed orders will understate your actual margins.
- Add a COGS column if your export doesn't include one. Label it
unit_cost. Fill in your average cost per product. If you're not sure of exact figures, use your best estimates — you can refine later. You should see a clean spreadsheet with one header row and consistent data in every column. - Rename your columns to plain, single-word labels with no spaces:
date,product,quantity,revenue,unit_cost. You should see headers that match this format exactly.
Inconsistent product names are the most common problem. "Widget A", "widget a", and "Widget A (new)" will be treated as three separate products. Standardize them now.
The exact prompts to use when you analyze sales data with AI
Open ChatGPT (GPT-4o) and start a new conversation. Upload your CSV using the paperclip icon.
Then run this sequence of prompts in order:
Prompt 1 — Data check:
"I've uploaded a CSV file with 90 days of sales data. The columns are: date, product, quantity, revenue, unit_cost. Please confirm you can read the file and tell me how many rows it contains, the date range covered, and the names of all unique products."
Wait for confirmation before continuing. This step catches misread headers before they corrupt the analysis.
Prompt 2 — Profitability calculation:
"For each product, calculate the following:
- Total units sold
- Total revenue
- Total cost (quantity × unit_cost)
- Total gross profit (total revenue − total cost)
- Gross margin percentage (gross profit ÷ revenue × 100)
Return this as a table ranked by gross profit, highest to lowest."
Prompt 3 — Surface the traps and the hidden winners:
"Looking at the profitability table you just created:
- Identify any products with high revenue (top 25% by revenue) but low margin (below 30%). These are potential profit traps.
- Identify any products with low revenue (bottom 25% by revenue) but high margin (above 50%). These are potential hidden winners.
- Flag any products with fewer than 5 orders that are running at near-zero or negative margin."
Prompt 4 — Month-over-month trend:
"Break down total revenue and gross profit by month for the top 5 products by gross profit. Show this as a table with one row per product per month."
Each prompt builds on the one before it. Don't combine them into one — you'll get less reliable output.
Reading the output: what to do with the ranked profitability table
The table the AI returns shows you four things worth acting on.
Your profit traps are high-revenue, low-margin items. They feel important because they show up big in your revenue report. They are not. Price them up, cut their cost, or reduce how prominently you sell them.
Your hidden winners are low-revenue, high-margin items. These deserve more attention — more promotion, more upsell positioning, more of your time.
Your zombie products are the ones flagged in Prompt 3's third bullet. A handful of orders per month, near-zero margin, and they still consume support time and inventory attention. These are candidates for discontinuation. Most owners have never formally evaluated them.
The month-over-month table tells you whether trends are moving toward or away from your profitable products. That's a different question than a snapshot ranking.
Common mistakes that skew the analysis
The AI returns revenue rankings, not profitability rankings. Cause: Your prompt asked "which products made me the most money" — which the AI reads as revenue. Fix: Always specify "gross profit" or "margin percentage" in your prompt. The prompt templates above include this language.
Products show up as dozens of separate line items. Cause: Inconsistent naming in your CSV — "Latte", "latte", "Latte 12oz" treated as separate products. Fix: Go back to your CSV, standardize the product name column, and re-upload.
COGS column is blank or zero for some rows. Cause: Your export partially included cost data, or you missed some products when filling in unit_cost manually. Fix: Ask the AI: "Which products have a unit_cost of zero? List them." Then fill in those values in your CSV and re-run Prompt 2.
What to do next
Run this analysis once, then set a calendar reminder for 90 days from now to repeat it. The second run takes under 30 minutes — the export, clean, and prompt sequence is already established. Build a reusable Google Doc with your four prompts saved and ready to paste.
If you want to take the financial layer further, read how to use AI to build a simple cash flow forecast for your small business.
FAQ
Can I use this with Claude instead of ChatGPT? Yes. Claude 3.7 Sonnet{:target="_blank"} supports file uploads and runs comparable analysis. Its narrative explanations tend to be easier to read for non-technical users. It has a smaller file size tolerance than ChatGPT, but for 90 days of small business sales data — typically a few hundred to a few thousand rows — it handles the file without issues. The prompt templates in this post work in Claude without modification.
What if I don't know my cost of goods sold?
Add a unit_cost column to your CSV and fill in your best estimates. For physical products, use your supplier invoice cost. For services, use your hourly cost or direct labor rate. Imprecise COGS data produces imprecise margin figures — but even rough estimates are more useful than analyzing revenue alone.
Does ChatGPT store my sales data after I upload it? OpenAI's current data handling means uploaded files in a conversation are used to generate responses and are not used to train models by default for Plus subscribers. Review OpenAI's privacy policy{:target="_blank"} for current terms. If your data includes customer names or payment details, remove those columns before uploading.
How often should I run this analysis? Quarterly is the practical answer. Monthly is useful if you run frequent promotions or have high SKU turnover. Annually is not often enough — pricing and cost structures shift faster than that.
My export has thousands of rows across hundreds of products. Will the AI handle it? ChatGPT's Advanced Data Analysis processes files up to approximately 50MB. Most small business exports covering 90 days fall well under that. If you have a very large product catalog, consider filtering the export to your top 50 products by revenue before uploading — then run a second pass for the long tail.
Prompts from this article
Check Your Sales CSV File With AI
Use this as the first prompt after uploading your sales CSV to verify the AI has correctly read your file and identified all products before running any calculations.
Calculate Product Profitability and Gross Margin
Use this as the second prompt after confirming the AI can read your file. It generates the core ranked profitability table showing gross profit and margin for every product.
Find Profit Traps and Hidden Winners in Your Product Range
Use this as the third prompt immediately after generating the profitability table. It surfaces which high-revenue products are actually poor performers and which low-revenue products deserve more attention.
Track Month-Over-Month Profit Trends by Product
Use this as the fourth prompt to see whether your most profitable products are trending up or down over the 90-day period, rather than just looking at a snapshot ranking.
Identify Products With Missing Cost Data
Use this troubleshooting prompt if your profitability results look off. It identifies which products are missing cost data so you can fill them in and re-run the profitability calculation.
Read Next
Using AI to build a simple weekly cash position update you can read in two minutes so you always know if you can make payroll
FinanceUsing AI to turn a one-page business summary into a pitch deck outline you can build in PowerPoint or Canva yourself
FinanceUsing AI to write a simple grant application for a small business funding program without a grant writer