Office workflows

Use ChatGPT to Find Anomalies in a Sample Sales CSV

Cihan's view: Upload a clean sample CSV, define what counts as unusual before analysis, ask ChatGPT to show its calculations, and verify every exception against the original rows before acting.

Choose another work task →

A sales report can look tidy while hiding a few rows worth asking about: an unusually large discount, a negative quantity, or a missing region. ChatGPT can help produce an exception table from a structured CSV, but an anomaly is a review prompt—not proof of fraud, a bad salesperson, or a forecast.

This is a documentation-based tutorial with fictional data and an illustrative acceptance result. It is not a recorded ChatGPT run or a claim about sales performance.

What you need

  • ChatGPT with file upload and data analysis available for your account or workspace. Availability varies by model, plan, and settings.
  • A CSV with descriptive headers and one record per row.
  • Permission to use the data in your approved AI environment. Start with the fictional file below.

OpenAI’s data-analysis documentation says ChatGPT can analyze CSV files, create tables, and run Python-backed calculations in some tasks. It also recommends reviewing generated code, outputs, and assumptions before relying on a result.

1. Create the practice CSV

Save this as sales-sample.csv:

order_id,region,rep,units,unit_price,discount_rate
S-101,West,Mina,10,40,0.05
S-102,West,Mina,2,40,0.50
S-103,North,Jon,8,75,0.10
S-104,North,Jon,-1,75,0.00
S-105,East,Lea,14,25,0.08
S-106,East,Lea,3,500,0.05
S-107,South,Arun,6,60,
S-108,South,Arun,5,60,0.10

The file is fictional. It includes one negative quantity, one missing discount rate, and one high-value row that should be reviewed without being declared wrong. Define the calculation before looking at a conclusion.

2. Upload the file and set the rules

Start a new ChatGPT chat, attach sales-sample.csv, and use this brief:

Analyze only the attached sales-sample.csv.

First report: column names, row count, duplicate order_ids, missing values,
negative values, and non-numeric values. Do not silently repair or remove rows.

Calculate line_total as units * unit_price * (1 - discount_rate), but do not
calculate a line_total when discount_rate is missing. Treat a row as an
exception when:
- units <= 0; or
- discount_rate is missing; or
- discount_rate > 0.30; or
- units * unit_price >= 2500.

Return:
1. An exception table with order_id, reason, and the original relevant values.
2. A reconciliation: input rows, exception rows, rows with known line_total,
   and rows excluded from the total because a required value is missing.
3. The line_total for every row with complete values, plus a grand total.
4. The Python code or calculation steps used.
5. A 60-word internal note that says these are review flags, not conclusions.

Do not infer fraud, rep performance, customer intent, urgency, or a sales
forecast. Keep missing values visible.

If data analysis is not available, do not treat a fluent table as proof. Verify the arithmetic in a spreadsheet or another approved method.

3. Check the expected exception table

For this sample, the exception rows should be:

Order Reason Check
S-102 discount_rate > 0.30 50% discount
S-104 units <= 0 -1 unit
S-107 missing discount_rate line total withheld

S-106 is not an exception under the stated 2,500 threshold: 3 × 500 is 1,500. A careful output should omit it, even though its unit price is high. This is an acceptance check for the rule, not a screenshot of ChatGPT output.

The complete rows have these line totals:

  • S-101: 380.00
  • S-102: 40.00
  • S-103: 540.00
  • S-104: -75.00, but the row remains an exception because quantity is negative
  • S-105: 322.00
  • S-106: 1,425.00
  • S-108: 270.00

The known-total sum is 2,902.00. S-107 is excluded from that arithmetic because its discount rate is missing. Independently check these figures before using them; they are calculated from the fictional input, not generated by a ChatGPT session.

4. Review before sharing a conclusion

Check the original CSV against the output:

  1. There are eight input rows and no duplicate order IDs.
  2. S-104 is visible because negative quantity is a defined exception.
  3. S-107 stays out of the numeric total rather than receiving an invented zero discount.
  4. S-106 is not flagged by the 2,500 gross-value rule.
  5. The internal note calls these items “review flags,” not misconduct or performance findings.

Only after these checks should you share the exception table with the responsible sales or operations owner. Ask them to explain or correct the source record; do not let the model decide the business outcome.

Troubleshooting

  • The model flags S-106: ask it to show units * unit_price and compare the result with the exact threshold.
  • The missing discount becomes zero: repeat “do not calculate a line_total when discount_rate is missing” and inspect the code.
  • The total includes S-107: request the included order IDs and reconcile them with the complete-value rule.
  • The CSV is parsed incorrectly: confirm the header row, delimiter, decimal format, and one-record-per-row structure before rerunning.

TRY / SKIP / USE: TRY this on a fictional or approved sample to learn whether the exception definition is useful. SKIP uploading customer or employee data without permission. USE the output only as a review queue after the source rows, calculations, and limits pass inspection.

Sources and next step

For a safer follow-up, add a second file containing the approved definitions for “returned,” “cancelled,” and “net sale,” then check whether the definitions—not the chart—change the answer.

About Cihan

Creator and operator focused on practical AI for business professionals. Background and editorial approach →