Skip to main content
  • Label: Sales
  • Description: Order-level metrics from the purchases table.
  • Default group key: transaction_id

Metrics

  • total_sales (USD)
    • Sales after discounts and before taxes/returns.
    • Example: SUM(total_sales)
  • quantity_purchased (items)
    • Number of items purchased.
    • Example: SUM(quantity_purchased)
  • orders (orders)
    • Unique orders (transaction_id).
    • Example: COUNT_DISTINCT(orders)
  • line_items (items)
    • Unique line items purchased.
    • Example: COUNT_DISTINCT(line_items)
  • customers (customers)
    • Unique customers who purchased.
    • Example: COUNT_DISTINCT(customers)

Dimensions

  • transaction_id: Shopify order ID.
  • line_item_id: Shopify line item ID.
  • product_id: Shopify product ID.
  • variant_id: Shopify variant ID.
  • customer_id: Shopify customer ID.
  • session_id: Session identifier derived from the order.
  • geo_country: Country from the shipping address.
  • geo_state: State or province from the shipping address.
  • geo_city: City from the shipping address.
  • shopping_channel: Channel of purchase (e.g., online_store).
  • marketing_source: UTM source.
  • marketing_medium: UTM medium.
  • marketing_campaign: UTM campaign.
  • device: Device category derived from User-Agent.
  • browser: Browser family from User-Agent.

Examples

Total revenue by country (last 30 days)
FROM sales
SHOW SUM(total_sales)
GROUP BY geo_country
SINCE -30d
Order count by marketing source (this month)
FROM sales
SHOW COUNT_DISTINCT(orders)
GROUP BY marketing_source
SINCE this_month
Customer count by shopping channel (past 90 days)
FROM sales
SHOW COUNT_DISTINCT(customers)
GROUP BY shopping_channel
SINCE past_90_days

Next steps