Understanding sales performance goes beyond identifying top Customers or top Sales Reps. For more effective sales management and forecasting, administrators and business leaders often need visibility into how each Sales Rep and Customer combination is performing—including order volume, unbilled amounts, and average deal size.
In this article, we demonstrate how to use an advanced SuiteQL query to analyze Sales Order data by both Sales Rep and Customer. This approach provides actionable insights into sales activity, highlights high-value relationships, and helps prioritize follow-ups based on unbilled sales performance.
Sample SuiteQL Query
SELECT
e.entityid AS salesrep_name,
c.entityid AS customer_name,
COUNT(t.id) AS sales_order_count,
SUM(t.amountunbilled) AS total_sales,
AVG(t.amountunbilled) AS average_order_value
FROM transaction t
JOIN customer c ON t.entity = c.id
JOIN employee e ON c.salesrep = e.id
WHERE t.type = 'SalesOrd'
GROUP BY e.entityid, c.entityid
ORDER BY total_sales DESC
How it works:
- JOINs:
- Connects transaction records to the correct Customer.
- Connects each customer to their assigned Sales Rep from the Employee table.
- Aggregations:
- COUNT(t.id): Tallies the number of Sales Orders for each Sales Rep/Customer pair.
- SUM(t.amountunbilled): Adds up the total unbilled sales for each pair.
- AVG(t.amountunbilled): Finds the average unbilled order value for each pair.
- GROUP BY: Groups the aggregated results by both Sales Rep (by display name) and Customer (by display name).
- ORDER BY total_sales DESC: Ranks the output from highest to lowest total unbilled sales.
To easily execute a SuiteQL query, see NetSuite Admin Tip | Running SUITEQL Using a Suitelet
The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
We’d love to hear how you integrate SuiteQL into your NetSuite processes! Share your insights and experiences in the NetSuite Admin Corner.