CodeRigor

LESSON

Publish a reconciled interactive report

Align current/prior windows, define undefined comparisons and export a complete offline dashboard with filters, honest charts and metric definitions.

The complete dashboard is a portable snapshot, not a live business analytics service. A supplied standard-library exporter runs your reconciled SQLite queries over original CSV fixtures and emits an offline HTML report. You can inspect the SQL, data, calculations and interface without a subscription or hosted database.

The embedded report below uses that same materialized order grain. Change dates, segment and channel; watch every KPI, chart and table update together. Data is synthetic and money uses integer cents until display or ratio calculation.

A reproducible dashboard pipeline
start / 3
Original CSV rows feed actual SQLite queries. The exported order facts drive an offline interactive report with visible definitions and independent reconciliation tests.
A reproducible dashboard pipeline
Original CSV rows feed actual SQLite queries. The exported order facts drive an offline interactive report with visible definitions and independent reconciliation tests.

The current window and prior window have the same inclusive length. The prior value for a day is available only if that shifted business date exists in the coverage calendar. A covered quiet date is zero; an uncovered date is unavailable.

Percentage change has an explicit policy. Unknown or zero prior values are undefined. Otherwise use 100 × (current − prior) / abs(prior). This convention handles negative adjustments consistently for this teaching report; it is not a universal business rule.

SQL
WITH t(current,prior) AS (VALUES(800,-500),(100,0),(100,NULL))
SELECT current,prior,CASE WHEN prior IS NULL OR prior=0 THEN NULL
 ELSE 100.0*(current-prior)/ABS(prior) END AS change_percent FROM t;

For the period KPI, first sum current and prior cents over their complete windows. Only show a prior total if every prior date is covered. Then calculate the ratio from those totals. Do not average daily percentages. The per-order average likewise divides total cents by total orders.

The chart domain includes zero and signed values, the channel bars start at zero, and the daily calendar retains quiet dates. Numeric tables and visible definitions provide a second reading path. Date inputs operate on normalized business dates rather than the viewer’s timezone.

The lab includes a schema, six actual query files, CSV inputs, a deterministic exporter, a starter query, a working dashboard and integration tests. Run the documented command, open the HTML file locally, then alter fixtures and rebuild. No remote database, cloud account or network execution is required.

Comparison coverage gates the ratio
start / 3
A complete known prior window permits a prior total. A nonzero prior total permits a percentage under the stated sign policy.
Comparison coverage gates the ratio
A complete known prior window permits a prior total. A nonzero prior total permits a percentage under the stated sign policy.
SQL
WITH periods(current,prior) AS (VALUES(200,100),(1100,1000))
SELECT SUM(current) AS current_cents,SUM(prior) AS prior_cents,
       100.0*(SUM(current)-SUM(prior))/ABS(SUM(prior)) AS period_change
FROM periods;

Finish the native query, download the lab and run its tests. Confirm the default five orders and 5,750 cents; switch to a zero-activity selection, a negative-adjustment window and an uncovered-prior window. Compare the browser series with the SQL output before editing visual styling.

This completes the SQL snapshot. Power Query ingestion, semantic relationships, DAX measures, richer cross-filtering and publishing/collaboration are a useful next stage in Boot.dev’s Power BI course.

Download the complete SQL dashboard lab: queries, CSV fixtures, exporter, offline dashboard and tests.

Download the queries, CSV data and offline report →

Watch & read

Free lectures, talks and readings that cover this skill from another angle. All resources →

Optional overview of what the later Power BI branch adds. The core SQL/browser lab here uses its own original fixtures and requires no Power BI installation.