Core Cubes

Warning

Start with views, not cubes. For most reporting use cases, we recommend using views like Sales, ItemSales, and ModifierSales instead of querying cubes directly. Views pre-join data from multiple cubes, pre-filter to closed orders, and provide human-readable dimensions. See Metadata Discovery for details.

Use cubes directly only when you need raw, unfiltered data or fields not available in any view.

Link to section

Overview

The two most commonly used cubes are Orders and PaymentAndRefunds. Understanding these cubes is essential for most reporting scenarios.

Link to section

Orders cube

The Orders cube is the primary source for sales analytics, containing measures and dimensions for completed transactions.

Link to section

Key Characteristics

  • Data Freshness: ~15 minutes
  • Use For: Historical analysis (yesterday and earlier), daily/weekly/monthly reports
  • Critical Segment: closed_checks (always use for sales reports)
Link to section

Key Measures

MeasureTypeDescription
net_salessumPrimary revenue metric (after discounts/returns, before tax)
net_sales_with_taxsumRevenue including sales tax
tips_amountsumTips received (non-cash)
sales_tax_amountsumSales tax collected
countcountNumber of orders
avg_net_salesavgAverage net sales per order
discounts_amountsumTotal discounts applied
itemized_returnssumReturns and refunds
Link to section

Key Dimensions

DimensionTypeDescription
location_idstringLocation where order was placed
sale_timestamptimeUTC sale time
local_datestringLocal business date (YYYY-MM-dd format)
sales_channel_idstringSales channel (online, in-person)
customer_idstringCustomer identifier
device_idstringDevice that processed the order
order_idstringUnique order identifier
Link to section

Key Segments

SegmentDescription
closed_checksFully paid orders (recommended for sales reports)
open_checksOrders awaiting payment
awaiting_captureOrders awaiting capture
fully_paidFully paid orders
has_tipOrders with tips
no_tipOrders without tips
has_customerOrders with a linked customer
Link to section

Example Query

{ "measures": [ "Orders.net_sales", "Orders.count", "Orders.avg_net_sales" ], "dimensions": ["Orders.location_id"], "timeDimensions": [{ "dimension": "Orders.sale_timestamp", "dateRange": "last 30 days" }], "segments": ["Orders.closed_checks"], "order": { "Orders.net_sales": "desc" } }

Returns sales performance by location for the last 30 days.

Link to section

PaymentAndRefunds cube

The PaymentAndRefunds cube provides detailed payment transaction data, including payment methods and refund information.

Link to section

Key Characteristics

  • Data Freshness: ~15 minutes
  • Use For: Payment method analysis, refund tracking
  • Relationship to Orders: One order can have multiple payments (split payments, partial payments)
Link to section

Key Measures

MeasureTypeDescription
total_amountsumTotal payment amount including tips and tax
tip_amountsumTips on this payment
countcountNumber of payment transactions
refund_total_amountsumTotal refunds
Link to section

Key Dimensions

DimensionTypeDescription
payment_idstringUnique payment identifier
order_idstringAssociated order identifier
typestringPayment type (CARD, CASH, etc.)
reporting_timestamptimeUTC payment time
location_idstringLocation where payment was made
payment_methodstringPayment method (CARD, CASH, etc.)
Link to section

Example Query

{ "measures": [ "PaymentAndRefunds.total_amount", "PaymentAndRefunds.count" ], "dimensions": ["PaymentAndRefunds.type"], "timeDimensions": [{ "dimension": "PaymentAndRefunds.reporting_timestamp", "dateRange": "last 30 days" }], "order": { "PaymentAndRefunds.total_amount": "desc" } }

Returns payment totals by payment type (CARD, CASH, etc.) for the last 30 days.

Link to section

Comparing the core cubes

FeatureOrdersPaymentAndRefunds
Freshness~15 min~15 min
Best ForSales analysisPayment method analysis
GranularityOrder levelPayment level
Key MetricNet salesPayment amounts
RelationshipOne orderMultiple payments per order
Link to section

When to use each cube

Link to section

Use Orders When:

  • Building daily/weekly/monthly reports
  • Analyzing sales trends and revenue
  • You need order-level metrics
Link to section

Use PaymentAndRefunds When:

  • Analyzing payment methods
  • Monitoring refunds
  • Understanding split payment patterns
  • Comparing payment amounts to order amounts
Link to section

Example queries for each cube

Link to section

Orders: Monthly Sales by Location

{ "measures": ["Orders.net_sales", "Orders.count"], "dimensions": ["Orders.location_id"], "timeDimensions": [{ "dimension": "Orders.sale_timestamp", "dateRange": ["2024-01-01", "2024-12-31"], "granularity": "month" }], "segments": ["Orders.closed_checks"] }
Link to section

PaymentAndRefunds: Payment Methods This Month

{ "measures": [ "PaymentAndRefunds.total_amount", "PaymentAndRefunds.count" ], "dimensions": ["PaymentAndRefunds.type"], "timeDimensions": [{ "dimension": "PaymentAndRefunds.reporting_timestamp", "dateRange": "this month" }] }