Skip to content

Semantic model ​

The model lives in cube/model/ as YAML. It is the single place where business logic is defined.

Cubes (internal, public: false) ​

CubeSourceHighlights
line_itemssales.order_items joined to orders (order date) and products (unit cost)revenue (net of discount), units, cost, gross_profit, gross_margin
orderssales.orderscount, completed_count, returned_count, return_rate, customers_count
customerssales.customerssegment, country, city, signup date
productssales.productsname, category, brand, list price

Joins: line_items → orders → customers, line_items → products.

Views (what users and the app see) ​

  • sales: order-line grain. Revenue, units, cost, profit and margin, by category, brand, product, channel, status, country, city and segment.
  • orders_overview: order grain. Order counts, return rate and buying customers, by channel, status and customer attributes.

Pre-aggregation ​

line_items.revenue_by_day is a daily rollup of revenue, units, line count and cost. It is split by category, brand, channel, status, country and segment, partitioned by month, and refreshed hourly. In Explore, queries that hit it show a ⚡ badge.

Changing the model ​

Edit the YAML and Cube recompiles it. If a change doesn't appear, run docker compose restart cube. Write a description on views and members: the app shows it, and future AI features will depend on it.