<aside> 🧮

For engineers, analysts, and anyone who needs the exact definition of a metric. This section documents every KPI on the FSP Marketing Dashboard — what it means, the plain-English formula, and the actual SQL/query behind it (source tables, joins, filters, timezone handling, and caching). One page per tab, plus a shared Conventions & Shared Filters page for the rules that apply everywhere.

</aside>

<aside> ⚠️

Keep this in sync with the code. When a query or metric calculation changes in the app (app/services/** calculators/queries, or the app/controllers/api/v1 endpoints), update the matching page here in the same change. Docs that drift from the code are worse than none.

</aside>

How the app computes metrics (the shared pattern)

Every tab follows the same shape, so read this once and it applies everywhere:


Pages

Start with Conventions & Shared Filters (the shared base filters, product scopes, timezone, and caching rules that every other page builds on), then jump to the tab you need.

🧭 Start here

Conventions & Shared Filters

🔻 Funnel

Closing Ratio — Metrics & SQL

Funnel — Core Metrics (Solar / Generator)

Funnel — HVAC Metrics

Funnel — Revenue & Costs + Forecast

📊 Sales performance

Set to Close — Metrics & SQL