Weld logo
amazon-mws
Amazon Selling Partner API

Monthly Sales Performance Reports

Extracts monthly sales performance reports for Amazon integration. It calculates the total sales amount, number of orders, and total items sold for each month. Additionally, it calculates the average order value by dividing the total sales amount by the number of orders. The results are ordered in descending order by month.
1with
2    MonthlySales as (
3        select
4            date_trunc(cast(PurchaseDate as date), month) month
5          , sum(OrderTotal_Amount) as TotalSalesAmount
6          , count(distinct AmazonOrderId) as NumberOfOrders
7          , sum(NumberOfItemsShipped + NumberOfItemsUnshipped) as TotalItemsSold
8        from
9            {{raw.amazon_selling_api_oauth.orders}}
10        group by
11            month
12    )
13select
14    month
15  , TotalSalesAmount
16  , NumberOfOrders
17  , TotalItemsSold
18  , TotalSalesAmount / NumberOfOrders as AverageOrderValue
19from
20    MonthlySales
21order by
22    month desc
Example of output from model:
+---------------------+-----------------+----------------+-----------------+-------------------+
|        month        | TotalSalesAmount | NumberOfOrders | TotalItemsSold  | AverageOrderValue |
+---------------------+-----------------+----------------+-----------------+-------------------+
|    2022-09-01       |     5000.00     |       10       |       50        |       500.00      |
|    2022-08-01       |     7000.00     |       15       |       75        |       466.67      |
|    2022-07-01       |     6000.00     |       12       |       60        |       500.00      |
|    2022-06-01       |     4000.00     |       8        |       40        |       500.00      |
|    2022-05-01       |     5500.00     |       11       |       55        |       500.00      |
+---------------------+-----------------+----------------+-----------------+-------------------+

The Monthly Sales Performance Reports SQL template is designed to analyze sales data from Amazon. It calculates various metrics such as total sales amount, number of orders, total items sold, and average order value on a monthly basis. The template utilizes the Amazon Selling API to retrieve order data and aggregates it by month. By running this SQL code, you can gain insights into the performance of your monthly sales on Amazon. The TotalSalesAmount metric provides an overview of the revenue generated each month, while the NumberOfOrders metric indicates the number of orders placed. The TotalItemsSold metric represents the total quantity of items sold during the specified period. Additionally, the AverageOrderValue metric is calculated by dividing the total sales amount by the number of orders, giving you an understanding of the average value of each order. The SQL template is particularly useful for generating monthly sales performance reports, allowing you to track sales trends, identify peak months, and compare performance across different time periods. This information can help you make data-driven decisions, optimize inventory management, and evaluate the effectiveness of marketing campaigns on Amazon.

Ready to start modeling your own amazon-mws data?

Get started building your data warehouse with amazon-mws and 100+ more apps and databases available.

amazon-mws
Weld logo
Sign up for free
Weld logo

Tired of scattered data? Sync your data in minutes with Weld. Connect to 150+ apps, files and databases.

Backed by leading investors
Frontline logoCherry logoInnnovation Fund logo
Twitter LogoLinkedIn Logo
GDPR logoSOC2
© 2024 Weld. All rights reserved.