Real-World Scenarios

Link to section

Overview

These examples show how to combine measures, dimensions, segments, and filters to answer complex business questions for restaurant operations.

Note

These examples use views (Sales, ItemSales) which are the recommended way to query the Reporting API. Views pre-join data from multiple cubes and pre-filter for common use cases. For the most up-to-date field names, check the Schema Explorer or the /v1/meta endpoint.

Link to section

Scenario 1: Daily sales by location

Business Question: "How are my locations performing day by day?"

{ "measures": [ "Sales.net_sales", "Sales.order_count", "Sales.avg_net_sales" ], "dimensions": ["Sales.location_name"], "timeDimensions": [{ "dimension": "Sales.local_reporting_timestamp", "dateRange": "last 30 days", "granularity": "day" }] }

What this returns: Daily net sales, order count, and average order value for each location over the last 30 days. Notice there's no segments needed — the Sales view automatically filters to closed orders, and gives you location_name directly instead of a raw ID.

Link to section

Scenario 2: Online vs in-store sales

Business Question: "How do my online sales compare to in-store?"

Online sales:

{ "measures": [ "Sales.net_sales", "Sales.order_count", "Sales.tips_amount" ], "dimensions": ["Sales.channel_name"], "timeDimensions": [{ "dimension": "Sales.local_reporting_timestamp", "dateRange": "this month", "granularity": "day" }], "segments": ["Sales.online"] }

In-store sales:

{ "measures": [ "Sales.net_sales", "Sales.order_count", "Sales.tips_amount" ], "dimensions": ["Sales.channel_name"], "timeDimensions": [{ "dimension": "Sales.local_reporting_timestamp", "dateRange": "this month", "granularity": "day" }], "segments": ["Sales.in_store"] }

What this returns: Daily sales by channel for the current month. Use the Sales.online or Sales.in_store segments to filter by sales channel type, or omit the segment and group by Sales.channel_name to see all channels.

Link to section

Scenario 3: Top-selling items

Business Question: "What are my best-selling items by revenue?"

What this returns: Top 20 items ranked by net sales, with category and quantity for context. The ItemSales view pre-joins item data with order and location information. Use the ItemSales.sales segment to exclude returns.

Link to section

Scenario 4: Refund analysis by location

Business Question: "How much was refunded last month, and which locations had the most refunds?"

What this returns: Refund totals by location name for orders that had refunds, sorted by highest refund amount. Compare against net sales to understand refund rates per location.

Link to section

Scenario 5: Team member performance

Business Question: "Which team members are collecting the most in sales and tips?"

{ "measures": [ "Sales.net_sales", "Sales.order_count", "Sales.tips_amount" ], "dimensions": ["Sales.employee_full_name"], "timeDimensions": [{ "dimension": "Sales.local_reporting_timestamp", "dateRange": "this month" }], "segments": ["Sales.has_tip"], "order": { "Sales.net_sales": "desc" } }

What this returns: Sales and tip totals by team member name for the current month, filtered to orders with tips. The Sales view gives you employee_full_name directly — no need to look up team member IDs.

Link to section

Key patterns in these scenarios

PatternUse CaseComponents Used
Location comparisonCompare performance across locationsSales view + location_name dimension
Channel analysisOnline vs in-storeSales view + Sales.online / Sales.in_store segments
Item-level analysisTrack menu item performanceItemSales view + item_name dimension + sales segment
Refund filteringFind orders with refundsSales view + filter on refunds_by_amount_amount > 0
Team performanceIdentify top performersSales view + employee_full_name dimension + has_tip segment
Link to section

Tips for building complex queries

  1. Start with a view — Use Sales for order-level reporting, ItemSales for item-level analysis
  2. Add time dimensions — Always scope to a specific date range
  3. Layer in dimensions — Add location, channel, or team member dimensions for grouping
  4. Apply filters — Use filters for thresholds or exclusions
  5. Use view segmentsSales.online, Sales.in_store, Sales.has_tip, ItemSales.sales, etc.
  6. Set reasonable limits — Especially important with multiple dimensions
  7. Order meaningfully — Sort by the metric that matters most for your analysis
  8. Use the right viewSales for orders, ItemSales for items, ModifierSales for modifiers
Link to section

Common query templates

Link to section

Sales Summary

{ "measures": [ "Sales.top_line_product_sales", "Sales.discounts_amount", "Sales.itemized_returns", "Sales.net_sales", "Sales.sales_tax_amount", "Sales.tips_amount", "Sales.total_collected_amount" ], "timeDimensions": [{ "dimension": "Sales.local_reporting_timestamp", "dateRange": "last 30 days", "granularity": "day" }] }
Link to section

Location Performance

{ "measures": ["Sales.net_sales", "Sales.order_count"], "dimensions": ["Sales.location_name"], "timeDimensions": [{ "dimension": "Sales.local_reporting_timestamp", "dateRange": "this month" }], "order": {"Sales.net_sales": "desc"} }