If you are learning data analytics, start with a business question before choosing a chart. This small project asks: Which product category generated the most sales, and does the leading category change by city? You will use SQL to check the totals, then build a Power BI report from the same six rows.
1. Create a practice dataset
Copy the following into a file named sales.csv. Each row represents one order; amount is the total order value in rupees. The data is intentionally small enough to check by hand.
order_id,order_date,city,category,amount
1,2026-10-01,Bengaluru,Accessories,1200
2,2026-10-02,Bengaluru,Books,800
3,2026-10-03,Mysuru,Accessories,900
4,2026-10-04,Mysuru,Books,700
5,2026-10-05,Bengaluru,Accessories,1500
6,2026-10-06,Mysuru,Books,1100
Before analysis, check that order IDs are unique, dates are valid, categories use consistent spelling, and amounts are numeric. In a larger dataset, record how you handle missing values and returns instead of silently deleting them.
2. Check the answer with SQL
Create a table and insert the same practice rows. The following uses basic SQL supported by common relational databases, although import tools and date handling can vary.
CREATE TABLE sales (
order_id INTEGER PRIMARY KEY,
order_date DATE,
city VARCHAR(40),
category VARCHAR(40),
amount DECIMAL(10,2)
);
INSERT INTO sales VALUES
(1,'2026-10-01','Bengaluru','Accessories',1200),
(2,'2026-10-02','Bengaluru','Books',800),
(3,'2026-10-03','Mysuru','Accessories',900),
(4,'2026-10-04','Mysuru','Books',700),
(5,'2026-10-05','Bengaluru','Accessories',1500),
(6,'2026-10-06','Mysuru','Books',1100);
SELECT category, SUM(amount) AS total_sales
FROM sales
GROUP BY category
ORDER BY total_sales DESC;
SELECT city, category, SUM(amount) AS total_sales
FROM sales
GROUP BY city, category
ORDER BY city, total_sales DESC;
The category totals should be Accessories ₹3,600 and Books ₹2,600. Overall sales should be ₹6,200 across six orders. Bengaluru totals ₹3,500; Mysuru totals ₹2,700. Accessories leads in Bengaluru, while Books leads in Mysuru.
That difference is the useful finding: one overall category ranking hides local variation. These six invented orders are too small to justify a real business decision, but they demonstrate how to ask the next question.
3. Build the Power BI report
In Power BI Desktop, use Get Data → Text/CSV to import sales.csv, then inspect the types in Power Query. Set the date column to Date, amount to a numeric type and order ID to a whole number. Microsoft documents the Text/CSV import workflow.
For this introductory exercise, a single table is enough. Create a measure named Total Sales:
Total Sales = SUM(sales[amount])
The DAX SUM function adds values from a column. Add a card showing Total Sales, a bar chart with category and Total Sales, and a city slicer. A small table with city, category and Total Sales makes it easier to reconcile the chart with your SQL output.
Clear every filter and confirm the card shows ₹6,200. Select Bengaluru and expect ₹3,500; select Mysuru and expect ₹2,700. If a total differs, check filters, data types and duplicated rows before changing the formula.
Why can a SQL join double your dashboard total?
A join can repeat a sales row when more than one record matches its key in the other table. If you then sum the repeated amounts, revenue is overstated. Check the meaning of each row and the number of matches before changing the chart or measure.
Use the six invented orders above. Suppose you add an order_tags table containing two tags for order 1: online and promotion. Every other order has one tag. A left join to that table returns seven rows: order 1 appears twice. Summing sales after the join gives ₹7,400 instead of ₹6,200 because its ₹1,200 amount is counted twice.
CREATE TABLE order_tags (
order_id INTEGER,
tag VARCHAR(40)
);
INSERT INTO order_tags VALUES
(1,'online'), (1,'promotion'),
(2,'online'), (3,'store'), (4,'store'),
(5,'online'), (6,'store');
SELECT COUNT(*) AS joined_rows,
SUM(s.amount) AS joined_sales
FROM sales AS s
LEFT JOIN order_tags AS t
ON s.order_id = t.order_id;
Expected result: seven joined rows and ₹7,400. The original six-order total is still ₹6,200. These are practice figures, not ScholarLogic business results.
How do you find the extra matches?
SELECT order_id, COUNT(*) AS tag_rows
FROM order_tags
GROUP BY order_id
HAVING COUNT(*) > 1;
This returns order 1 with two tag rows. Two tags may be legitimate data; deleting one would lose information. If your question is only total order revenue, sum the original sales table. If you need a tag filter, select qualifying orders once with an existence check, or design an explicit allocation rule. Do not assume that revenue grouped by overlapping tags should add up to the overall total.
Will SUM(DISTINCT amount) fix duplicate revenue?
It is not a reliable general fix. Two different orders can legitimately have the same amount. Removing duplicate amount values would then undercount revenue. Deduplicate using the correct business key and a documented rule, rather than the amount alone.
What should you check in Power BI?
A SQL join or a Power Query merge physically changes the result rows; a model relationship is different and controls how filters propagate. If a total is wrong, first compare the imported row count and unfiltered total with the source. Then inspect relationship keys, cardinality, filter direction and measure logic.
Microsoft’s relationship documentation explains uniqueness and cardinality. Its many-to-many guidance describes when bridge tables or dimension tables are appropriate. Use the model that matches the data; changing everything to many-to-many is not a universal repair.
A three-number reconciliation checklist
- Original sales: six rows and ₹6,200.
- Joined practice result: seven rows and ₹7,400.
- Correct unfiltered revenue report at order grain: ₹6,200.
Record the row meaning, join keys, expected total and reason for any difference in your project README. This makes your analysis easier for a trainer or interviewer to review.
4. Explain the work in an interview
Your explanation should cover the business question, row meaning, checks, SQL grouping, report design and limitations. Explain why a city slicer changes the measure and why this small dataset cannot establish future demand. A screenshot alone does not demonstrate that you understand the analysis.
To extend the project, add realistic returns, more months and a separate product table. Keep the dataset artificial or properly licensed, protect personal information, and document every assumption. Avoid adding complicated visuals until you can reconcile the totals.
Learning the complete workflow
SQL and Power BI are useful together because you can independently check the analysis and then communicate it clearly. ScholarLogic’s five-month Data Analytics course in Bangalore covers Excel, SQL, Power BI, Python and Gen AI. You can request a demo callback to ask about the current syllabus, batch options and project feedback. Confirm fees and support terms with the team before enrolling.