Companion film
Many hands
Watch an offscreen teammate change units and leave a comment while the shared model updates without a refresh.
24 secGrid 0.61.0
Open film page →Canonical Grid model
Keep paid-order revenue and margin enriched by customer and product dimensions, KPI cells, and a dashboard current as source rows change.
What this model gives you
30 min to study · Source reviewed 2026-08-24
Continue with guided practiceExpected checkpoint
After loading the tutorial sample rows into the three named schemas.
Connectors, imports, table edits, or mutations can feed the same Orders, Customers, and Products contracts.
Paid orders gain segment, cost, and category before margin is grouped by segment.
Layout tiles bind to TotalRevenue, TotalMargin, RevenueAlert, and ActiveSegments instead of duplicating formulas.
MODEL "Live Revenue KPI"
DESCRIPTION "Keep paid-order revenue and margin enriched by customer and product dimensions, KPI cells, and a dashboard current as source rows change."
VERSION "1.0.0"
AUTHOR "Grid"
TAGS "live-model", "relational", "join", "kpi", "dashboard", "surfaces"
# Orders and Customers are durable model tables populated by connectors,
# imports, rules, or ordinary table mutations. Every derived table below stays
# current incrementally, and the KPI cells and dashboard follow their revisions.
table Orders = { schema: "Orders" }
table Customers = { schema: "Customers" }
table Products = { schema: "Products" }
table PaidOrders = SELECT customer_id, product_id, amount AS revenue
FROM Orders
WHERE status = "paid"
table CustomerEnrichedOrders = SELECT p.customer_id, p.product_id, p.revenue, c.segment
FROM PaidOrders AS p
LEFT JOIN Customers AS c ON p.customer_id = c.customer_id
table EnrichedPaidOrders = SELECT e.customer_id, e.revenue,
e.revenue * (1 - COALESCE(p.cost_rate, 0)) AS margin,
e.segment, p.category
FROM CustomerEnrichedOrders AS e
LEFT JOIN Products AS p ON e.product_id = p.product_id
WHERE e.revenue > 0
AND (p.category IN ("software", "services") OR p.category IS NULL)
table RevenueBySegment = SELECT segment, SUM(revenue) AS revenue,
SUM(margin) AS margin
FROM EnrichedPaidOrders
GROUP BY segment
TotalRevenue IS currency = RevenueBySegment.sum("revenue")
TotalMargin IS currency = RevenueBySegment.sum("margin")
ActiveSegments = RevenueBySegment.count()
RevenueAlert = TotalRevenue > 100000
Dashboard!type = "layout"
Dashboard!config = """
version = 1
kind = "layout"
title = "Live Revenue"
[layout]
cols = 12
rows = 4
show_controls = true
[[tiles.static]]
title = "Paid Revenue"
x = 0
y = 0
w = 4
h = 2
formula = "=TotalRevenue"
[[tiles.static]]
title = "Paid Margin"
x = 4
y = 0
w = 4
h = 2
formula = "=TotalMargin"
[[tiles.static]]
title = "Revenue Alert"
x = 8
y = 0
w = 4
h = 2
formula = "=RevenueAlert"
[[tiles.static]]
title = "Freshness"
x = 0
y = 2
w = 8
h = 2
body = "Orders, Customers, and Products changes flow through filtering, keyed enrichment, post-join margin, and RevenueBySegment into these tiles without rebuilding the model."
[[tiles.static]]
title = "Active Segments"
x = 8
y = 2
w = 4
h = 2
formula = "=ActiveSegments"
"""
Dashboard!data = ""
END MODEL