AS TABLES (o AS orders PRIMARY KEY (id), c AS customers PRIMARY KEY (id) UNIQUE (alt_key)) RELATIONSHIPS (o_to_c AS o(customer_id) REFERENCES c(alt_key)) FACTS (o.net AS o.price * (1 - o.discount)) DIMENSIONS (c.region AS c.region) METRICS (o.total USING (o_to_c) AS SUM(o.amount), o.bal NON ADDITIVE BY (region DESC NULLS LAST) AS SUM(o.balance), o.run AS SUM(total) OVER (PARTITION BY EXCLUDING region ORDER BY region ASC NULLS LAST))
