Skip to main content

ISA-002 — Revenue Aggregation

🟢 Beginner

⏱ 15 Minutes

⭐ 10 Points

🔓 Free

💻 SQL | PySpark

🏢 Retail Analytics


Business Context

A retail company receives order-level transaction data from multiple stores.

Business stakeholders want a customer-level revenue report showing how much revenue each customer has generated.

The analytics team needs a summarized dataset that can be used for dashboards and KPI reporting.


Dataset

customer_orders
order_idcustomer_idamount
O101101100
O102101150
O103102200
O10410350
O10510375

Task

Calculate the total revenue generated by each customer.

Return one record per customer.


Expected Output

expected_output
customer_idtotal_revenue
101250
102200
103125

Constraints

  • Each customer may have multiple orders.
  • Revenue is the sum of all order amounts for that customer.
  • Final output should contain exactly one row per customer.

Supported Languages

✅ SQL

✅ PySpark


Hint

Aggregate the amount column at the customer level.


Solution

🔒 Premium Solution

Premium members receive:

  • SQL Solution
  • PySpark Solution
  • Step-by-Step Explanation
  • Optimization Discussion

Notebook Workspace

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