Sales Pipeline Value

ASKED IN INTERVIEW
4pts
Salesforce

Problem Statement

Calculate the financial performance of sales reps by totaling their Closed Won and In Progress deals.

Rules:

  • Output columns: sales_rep_id, closed_won_value, in_progress_value.
  • Value = quantity * unit_price.
  • Statuses to track: 'Closed Won' and 'In Progress'.
  • Use 0 if no deals exist for a specific status.
  • Results must be sorted by closed_won_value in descending order.
Tests your understanding of
Conditional Aggregation, Joins and Arithmetic Operations

Input Tables

sales_reps
sales_rep_id(INTEGER)rep_name(VARCHAR)
1Marc Benioff
2Amy Weaver
3Parker Harris
opportunities
opp_id(INTEGER)sales_rep_id(INTEGER)product_id(INTEGER)quantity(INTEGER)status(VARCHAR)
1011102Closed Won
1021201In Progress
1032105Closed Won
1043103In Progress
1051101Closed Won
1062202In Progress
products
product_id(INTEGER)unit_price(DECIMAL)
101000
205000

Expected Output

sales_rep_id(INTEGER)closed_won_value(DECIMAL)in_progress_value(DECIMAL)
2500010000
130005000
303000

Tags

MediumASKED IN INTERVIEWConditional AggregationJoinsArithmetic Operations
15-20 min
58%

Hints