Skip to main content

salesStatistics

Aggregated sales statistics, grouped by the requested dimensions. Powers "sales by ..." admin reports (product, day, customer, country, month, brand, and combinations thereof) via a single flexible query rather than one query per report variant. Restrictions: Admin only.

salesStatistics(
dimensions: [SalesStatisticsDimension!]!
metrics: [SalesStatisticsMetric!]!
dateRange: SalesStatisticsDateRange!
filter: SalesStatisticsFilter
orderBy: SalesStatisticsOrderBy
limit: Int! = 1000
): SalesStatisticsResult

Arguments

dimensions ● [SalesStatisticsDimension!]!

Which columns to group by. One row per unique combination of values. Order does not matter.

metrics ● [SalesStatisticsMetric!]!

Which aggregates to compute per row.

dateRange ● SalesStatisticsDateRange!

Date range to aggregate over (based on order created time).

filter ● SalesStatisticsFilter

Additional filters, ANDed together.

orderBy ● SalesStatisticsOrderBy

How to sort rows, e.g. for a top-N-by-metric report. metric must be one of the requested metrics.

limit ● Int!

Hard cap on number of returned rows (default 1000, max 5000). Narrow dateRange/filter instead of raising this.

Type

SalesStatisticsResult

Result of a sales statistics query.