2025 Online Store Sales Analysis

How 13,412 rows of messy transaction data became a dashboard that helps the management team make confident decisions on stock and promotions.

Excel SQL (MySQL) Python (pandas) Power BI
Business questions: (1) Which categories and cities drive the most revenue? (2) When do sales peak? (3) How much of the transaction data is invalid, and why?
Step 1

The raw data

I exported the data from the point-of-sale system as a CSV. Before changing anything, I opened it in Excel and skimmed through it to spot anything unusual. Here are the first 8 rows (13,412 rows and 8 columns in total). Red cells highlight the issues I found.

order_idorder_datecustomercitycategoryqtypricestatus
100105/01/2025Budi SantosoJakartaElectronics2Rp 350.000Completed
10022025-01-07siti aminahjktFashion1150000completed
10022025-01-07siti aminahjktFashion1150000completed
100312 Jan 2025AndiBandungelectronics-1350000Cancelled
100415/01/2025Dewi LestariSurabayaHousehold3(empty)Completed
100520/01/2025RinaBandungFashion2Rp 120.000Completed
10063/2/25AgusMedanFood545000Completed
100703/02/2025Budi SantosoJakartaElectronics1350000completed

Issues found: mixed date formats, prices stored as text ("Rp 350.000"), inconsistent city and category spellings (jkt, Jakarta, electronics), duplicate order IDs, negative quantities, and missing prices.

Step 2

Cleaning the data

I used Python (pandas) because the dataset has well over ten thousand rows and the rules need to be repeatable. Every decision is documented so it can be explained and defended.

import pandas as pd

df = pd.read_csv("sales_raw.csv")

# 1. Remove duplicates based on order_id
df = df.drop_duplicates(subset="order_id")

# 2. Standardize date formats
df["order_date"] = pd.to_datetime(df["order_date"], dayfirst=True, errors="coerce")

# 3. Price: strip "Rp" and dots, convert to a number
df["price"] = (df["price"].astype(str)
               .str.replace(r"[^0-9]", "", regex=True)
               .replace("", None).astype(float))

# 4. Standardize text
df["city"] = df["city"].str.strip().str.title().replace({"Jkt": "Jakarta"})
df["category"] = df["category"].str.strip().str.title()
df["status"] = df["status"].str.strip().str.capitalize()

# 5. Fill missing prices with the median per category
df["price"] = df["price"].fillna(df.groupby("category")["price"].transform("median"))

# 6. Drop cancelled orders and invalid quantities
df = df[(df["status"] == "Completed") & (df["qty"] > 0)]

As a result, the cells that were red are now consistent (green). Duplicate rows and cancelled orders (struck through) are removed, and I added a total column.

order_idorder_datecustomercitycategoryqtypricetotal
10012025-01-05Budi SantosoJakartaElectronics2350000700000
10022025-01-07Siti AminahJakartaFashion1150000150000
10032025-01-12AndiBandungElectronics-1350000removed (cancelled)
10042025-01-15Dewi LestariSurabayaHousehold385000255000
10052025-01-20RinaBandungFashion2120000240000
10062025-02-03AgusMedanFood545000225000

Cleaning summary

  • Starting rows: 13,412
  • Duplicates removed: 418
  • Cancelled orders removed: 371
  • Invalid qty/price: 143
  • Clean rows: 12,480

Why fill missing prices with the median?

The average is easily pulled up by high-priced items, while the median stays more stable. Only 0.6% of rows were filled, so the impact on totals is minimal. I noted this assumption in the documentation.

Step 3

Analyzing the data

I loaded the clean data into MySQL and calculated the metrics that answer the business questions. Here are sample queries for monthly revenue and category contribution:

-- Revenue per month
SELECT DATE_FORMAT(order_date, '%Y-%m') AS month,
       COUNT(*)            AS order_count,
       SUM(qty * price)    AS revenue
FROM sales_clean
GROUP BY month
ORDER BY month;

-- Contribution by category
SELECT category,
       SUM(qty * price) AS revenue,
       ROUND(100 * SUM(qty * price) /
         (SELECT SUM(qty * price) FROM sales_clean), 1) AS percent
FROM sales_clean
GROUP BY category
ORDER BY revenue DESC;

Metrics calculated

  • Total revenue = qty × price
  • Average order value (AOV) = revenue ÷ order count
  • Q4 vs Q3 growth
  • Category and city contribution (%)

How I used each tool

  • Excel: initial inspection and sample validation
  • Python: cleaning and automation
  • SQL: aggregation and joins
  • Power BI: visualization and dashboards
Step 4

The dashboard

I connected the query results to Power BI. Below is a condensed version of the dashboard.

Rp 1.56 BTotal revenue
12,480Total orders
Rp 125KAverage order value
+32%Q4 vs Q3

Monthly revenue (Rp millions)

Category contribution

City contribution

Step 5

Findings and recommendations

Findings

  • Electronics is the top performer, contributing 38% of revenue.
  • Jakarta and Bandung together account for 52% of sales.
  • Sales jump sharply in November–December (the 11.11 and 12.12 shopping festivals, plus payday).
  • Around 7% of the raw data was invalid, mostly duplicates and cancelled orders.

Recommendations

  • Increase Electronics and Fashion stock starting in October.
  • Test free-shipping promos in Medan and Surabaya, where contribution is still low.
  • Add input validation to the POS system so date and city formats stay consistent.