Description: This query shows the active sales reps ranked by revenue. Amount is tallied from closed and won opportunities by the sales reps derived from Salesforce data.
Requirements: Collect the `User` and `Opportunity` objects with the Panoply Salesforce data source
Usage: This query can be displayed in a tabular or pivot form to display the revenue per active sales rep
Modifications: The table in the `FROM` might need to be changed based on Schema and Destination settings in the data source. The Date Range Filter using the `closedate` in the `WHERE` clause can be changed.
WITH salesforce_user AS (
id, email, firstname || ' ' || lastname AS "rep"
us.rep AS "sales_rep",
sum(op.amount) AS "revenue"
ON op.ownerid = us.id
op.stagename = 'Closed Won'
AND DATE_TRUNC('quarter', "closedate") = DATE_TRUNC('quarter', current_date)
Query Results Dictionary
sales_rep: Opportunity Owner (Sales Rep)
email: Sales Rep Email
revenue: Sum of amount from closed/won opportunities by sales rep.
Please sign in to leave a comment.