Skip to main content

ISA-013 — Product Revenue Analysis

🟢 Beginner

⏱ 25 Minutes

⭐ 20 Points

🔓 Free

💻 SQL | PySpark

🏢 Retail Analytics

🎯 INNER JOIN

🎯 GROUP BY


Business Context

A retail company sells products through an online platform.

Management wants to understand which products generate the most revenue.

Product information is stored separately from sales transactions.

The analytics team has been asked to calculate total revenue generated by each product.


Business Impact

Product revenue analysis helps:

  • Identify top-performing products
  • Optimize inventory planning
  • Improve pricing decisions
  • Support executive reporting

This type of analysis is commonly used in BI dashboards and sales reporting.


Dataset

products

products
product_idproduct_name
P101Laptop
P102Mobile
P103Headphones

order_items

order_items
order_idproduct_idamount
O001P1011000
O002P1011200
O003P102800
O004P103200
O005P102700

Task

Calculate total revenue generated by each product.

Return:

  • product_name
  • total_revenue

Expected Output

expected_output
product_nametotal_revenue
Laptop2200
Mobile1500
Headphones200

Constraints

  • Join products with order_items using product_id.
  • Aggregate revenue at product level.
  • Return one row per product.

Supported Languages

✅ SQL

✅ PySpark


Data Engineering Pattern

Dimensional Aggregation Pattern

A dimension table provides descriptive attributes.

A transaction table provides measurable facts.

The two are combined to produce business metrics.


Concepts Tested

  • INNER JOIN
  • GROUP BY
  • SUM
  • Aggregation
  • Revenue Analytics

Hint

First combine products and transactions.

Then aggregate revenue by product.


Solution

🔒 Premium Solution

Premium members receive:

  • SQL Solution
  • PySpark Solution
  • Step-by-Step Explanation
  • Join Visualization
  • Aggregation Walkthrough
  • Alternative Approaches

Notebook Workspace

Cell 1Dataset: products
15:00
Loading...
Run Results
✓ Workspace Ready
Rows Returned: --
Execution Time: --
Engine: Coming Soon
Execution Engine Coming Soon