Navigation
← All projects

Chocolate Sales Analytics

What can we trust about the sales figures?

Which products bring in the most revenue? Do larger discounts go with larger orders? I started with 200,000 sales records, cleaned the data in Python and built a connected Power BI model to explore those questions.

Independent analytics and BI project · Python cleaning, star-schema modelling and DAX calculations in Power BI.

The starting point

Before comparing sales, make the numbers comparable.

I wanted to understand which products and sales channels performed well. But the 200,000 raw records had missing prices, mixed date formats and inconsistent shipment quantities. Before building the report, I needed to work out which values could be corrected and which records could not be used.

Which sales patterns remain meaningful after cleaning the data?

The problem behind it

A neat dashboard can still show misleading numbers. The challenge was to prepare the sales records carefully, connect them in a model and make the calculations consistent across the report.

Project walkthrough

From messy sales records to a report you can explore

  1. Find the problems in the raw data

    I checked 200,000 records for missing information, duplicates, inconsistent dates and negative shipment quantities. Dates had to be read correctly before any year-to-year comparison would make sense.

  2. Recover what can be explained

    Where enough information was available, I calculated missing prices or discounts from the sales equation. I checked some negative quantities against the order amount with a 20% tolerance before changing their sign.

  3. Build the reporting model

    After cleaning, I exported the data for Power BI and organised it as a star schema: sales records in the centre, linked to tables that describe them. This gives the report a shared structure for comparisons.

  4. Turn the figures into business questions

    DAX calculations support year-over-year comparisons. The dashboard and Python analysis explore products, countries, sales channels and average order value, as well as how discounts and marketing spending relate to sales.

A view from the project. See the results below for more detail.

A view from the project. See the results below for more detail.

Chocolate Sales Analytics

Project overview

Decisions

Fix the foundations before building the report.

Dates came in different formats, some prices and discounts were missing, and some shipment quantities were negative. I used Python to check these issues and calculate missing values where the sales equation allowed it. For some negative quantities, I checked whether changing the sign brought the amount within a 20% tolerance. I then organised the cleaned data into a star schema: a central sales table connected to descriptive tables. DAX, the calculation language in Power BI, supports measures such as year-over-year comparisons.

Governance

Be clear about what was changed.

Recovering a missing value can save a useful record, but the calculation needs a clear reason. Here I treated negative shipments as sign errors. In a real business, I would first check whether they were returns. Keeping both the original and corrected values would make that review easier.

Related governance examples

Results

What the results show

The notebook records 199,490 rows after cleaning. In that prepared dataset, wholesale orders have an average value about 37% higher than retail orders. Discounts and shipment quantities have only a weak relationship, around 0.18. These findings give a business useful questions to investigate, rather than proving what caused the differences.

Power BI model

1 / 3Power BI model

Power BI model

cleaning logic

analytical dashboard

What to keep in mind

What to keep in mind

These are results from the saved project outputs. The reported figures depend on the cleaning rules, including the 20% tolerance and the treatment of negative quantities. Relationships in the charts do not prove that discounts or marketing caused a change in sales.

← More projectsDiscuss this project ↗