DEV Community

Tasnem Islam Prome
Tasnem Islam Prome

Posted on

Analysing UK Retail Sales and Profitability Using Python and SQL

Tags: #dataanalytics #python #sql #datascience

Revenue tells us how much a business sells. Profit tells us how much value it keeps.

Understanding the difference is an important part of business data analysis.

I explored this through my UK Retail Sales Performance Analysis project.

Project Overview

The project analyses 2,500 synthetic UK retail transactions from 2025.

The dataset covers five regions, four product categories and two sales channels.

My objective was to practise transforming transaction records into meaningful business metrics.

Analytical Workflow

The workflow includes:

  1. Importing raw transaction data.
  2. Checking missing values and duplicates.
  3. Standardising inconsistent fields.
  4. Calculating revenue and profitability metrics.
  5. Running SQL queries.
  6. Creating visualisations.
  7. Interpreting business results.

The raw dataset intentionally contains minor data-quality issues to demonstrate cleaning techniques.

Key Results

The repository reports:

KPI Result
Total revenue £320,707
Total profit £116,331
Profit margin 36.3%
Return rate 9.2%
Top revenue region Midlands
Top profit category Electronics

These are results from simulated transactions, not real UK retail market statistics.

Example SQL Query

One of the included queries calculates regional revenue:

SELECT
    region,
    ROUND(SUM(revenue_gbp), 2) AS revenue
FROM retail_sales
GROUP BY region
ORDER BY revenue DESC;
Enter fullscreen mode Exit fullscreen mode

This produces a ranked view of revenue contributions by region.

Turning Analysis into Decisions

The analysis raises several business questions.

Should management investigate why the Midlands performs strongly?

Are high-revenue products also generating strong profits?

Do discounts improve sales volume at the expense of profitability?

Could high return rates reduce the value of certain product categories?

The synthetic dataset cannot establish real-world answers, but it provides a useful environment for practising analytical reasoning.

Future Improvements

I would like to extend this project with Power BI, customer segmentation, forecasting and automated reporting.

Conclusion

This project helped me connect Python and SQL analysis with business decision-making.

The most useful takeaway was that revenue, profit, returns and discounts need to be examined together.

GitHub: https://github.com/tasnem-tech/uk-retail-sales-analysis

What business metric would you investigate first when reviewing a retail dataset?

Top comments (0)