Skip to content
Tech Interview Prep
Technical interview guide

Dashboard Design Principles

Building a dashboard that actually gets used and drives decisions, not one that just looks comprehensive.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: WCAG 2.2 and current W3C WAI, USWDS, Microsoft Power BI, Tableau, Google Looker, Grafana, Vega-Lite, and UK Government Analysis Function guidance reviewed 2026-09-04.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-15

How do you apply pre-attentive attributes to establish a clear visual hierarchy in a metric-dense dashboard?

Answer

Two things I'd clarify before designing anything: who reads this dashboard, and how often it changes. An on-call engineer glancing at a wall monitor needs a different hierarchy from an analyst doing a weekly review. I'll assume the on-call case: a 27-inch monitor, 40–50 tiles, refreshed every 30 seconds, read in 5–10 second glances.

Under those assumptions the answer is subtraction, not addition: assign one pre-attentive channel per hierarchy level, mute everything that isn't at the top, and reserve saturated hue and motion for active breaches.

Why that works: hue, intensity, size, orientation, position, shape, enclosure and motion are processed in parallel in under about 250 ms, before conscious scanning starts. But the parallelism is narrow. Stack four or five competing channels on the same mark and the viewer drops back to serial search: that's the mechanism behind "the dashboard feels slow to read." The budget is roughly one dominant channel per tier.

Tier 1 is system status: a top-left band, three to five numbers, 24–32pt semibold, neutral color. The only saturated mark on the screen is a value that has crossed its threshold, and it carries a glyph (▲ or !) plus a word ("Degraded") so hue isn't the sole carrier: WCAG 2.2 SC 1.4.1. Tier 2 is drivers: the center viewport, trend lines, monochrome or at most two category hues, because position and line form already separate the series. Tier 3 is context: bottom of the page or a drawer, 11–12pt regular gray, tables and logs. Nobody reads those pre-attentively; they exist for the follow-up after the glance has already found the problem.

A worked example. Six services × eight metrics is 48 tiles. First version: every tile has a colored header keyed to its service, so 48 saturated marks compete and the six hues carry no meaning. Second version: every tile is neutral gray, value in 20pt semibold, service name 12pt gray, and only tiles breaching their SLO get a red value plus ▲. Now the squint test at five seconds answers the only question that matters, which service is failing, because exactly one mark survives the blur. The grayscale test is the check on that: desaturate the screen, and if the hierarchy disappears, hue was doing all the work.

Failure modes I'd name. Color over-indexing: when a dozen tiles are red, none of them is, and the reader has to read every number anyway. Hue-only encoding: roughly 1 in 12 men have red-green color vision deficiency, so red/amber/green needs the glyph and the label. Contrast: 4.5:1 for text (SC 1.4.3) and 3:1 for graphical marks and UI boundaries (SC 1.4.11). Thin gray gridlines and 10pt axis labels are the usual offenders. Motion: it's the strongest pre-attentive cue, which is exactly why a blinking tile on a shared monitor is hostile; use it for one thing at most, and honor prefers-reduced-motion.

When not to apply it: under about ten metrics there's no hierarchy to build; an executive weekly review read over minutes can afford more color and annotation than a glanceable wall board; and print or PDF loses motion and hover, so the hierarchy has to survive on position, size and contrast alone.

Detection is cheap: the five-second squint test, the grayscale test, and a count of saturated marks on screen. More than about three and the hierarchy is gone.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-3

Choose chart types for comparison, trend, distribution, and relationship tasks.

Answer

Start by naming the task, not the chart. Comparison: bars or dots on a common scale. Trend: line. Distribution: histogram, ECDF, or box/violin. Relationship: scatter. That is the 60-second answer. Then say what you would check: number of categories, whether x is ordered, whether you need exact lookup, and whether overplotting or bin-width sensitivity will dominate.

Cleveland and McGill (1984) ranked graphical encodings by accuracy: position on a common scale, then position on non-aligned scales, length, angle, area, volume, colour. That ranking is why a sorted bar chart beats a pie for comparison: angle and area are lower-precision. It is also why a line beats a stacked area for trend: the eye reads slope from position, not from cumulative thickness.

TaskDefaultWhy it worksWhen it is wrongConcrete failure
ComparisonSorted horizontal bar or dot plot on a common axisPosition on a common scaleMore than about 20 categories30-category bar chart: labels collide, differences below 2% are invisible. Use a dot plot or heatmap.
TrendLine with time on xSlope read from positionx is unorderedA line through regions implies a sequence that does not exist. Use bars.
DistributionHistogram plus ECDF, or box/violinShows shape, tails, modesSmall n or bin-width sensitiveA histogram of 40 points changes shape with bin width 5 versus 10. ECDF is stable.
RelationshipScatterPosition on two axesOverplotting10,000 points in one blob hide density. Use hexbin, 2D density, or alpha.

Worked trace. You have 12 regions, 24 months of revenue, and customer age. Comparison: sorted bar of total revenue by region. Trend: line of monthly revenue, one line per region or small multiples. Distribution: histogram of customer age with 5-year bins, plus ECDF. Relationship: scatter of age versus revenue, coloured by region only if there are 4 or fewer regions; otherwise small multiples. If you need exact values for a board deck, use a table.

Area encoding arithmetic: if you double the radius of a bubble, area goes up 4x. A 2x value looks 4x. That is why bubble charts fail for precise comparison; use position.

Failure modes and detection. Pie with 12 slices: the smallest slices at 3% and 4% are indistinguishable; ask three viewers to rank them. Truncated y-axis on a bar chart: a 2% difference looks like 2x; check that bars start at zero. Dual-axis line chart: two unrelated series look correlated; compute the correlation and check units. Red-green colour for categories: about 8% of men of Northern European ancestry have red-green colour vision deficiency; run a grayscale print test.

Trade-offs. A bar chart is wrong when categories are many or when the question is distribution across a continuum. A line is wrong when x is not ordered. A scatter is wrong when overplotting hides density. A table is wrong when you need pattern, not lookup. A map is wrong when the question is not spatial; a map of sales by state often just shows population.

So the answer is: match encoding to task, use position first, and name the failure mode you are avoiding.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-4

Set truthful axes and scales for dashboard charts.

Answer

First clarify the comparison. If the dashboard answers “how much?” (totals, shares, counts) the axis must preserve ratio. If it answers “which way and when?” (trend, change point) a focused range is defensible. State that assumption before choosing.

For bars, use zero. Chart.js v4’s linear scale defaults beginAtZero: false, so you must set it:

JavaScript
new Chart(ctx, {
  type: 'bar',
  data,
  options: {
    scales: {
      y: {
        beginAtZero: true,
        title: { display: true, text: 'MAU' }
      }
    }
  }
});

Why: viewers compare bar length from a common baseline. A truncated bar axis breaks the ratio between length and value. Example: MAU 1,000,000 vs 1,050,000. Zero axis 0–1,050,000: the 50,000 gap is 4.8% of the axis. Truncated 990,000–1,060,000: the same gap is 50,000/70,000 = 71% of the axis. A viewer reads “A is much smaller” when it is 5% smaller. Detection: ask a viewer to estimate the ratio; if the estimate is off by more than 2x, the axis is lying.

For lines, a focused range is acceptable for change detection if you label bounds and don’t use it to imply magnitude. Chart.js: suggestedMin: 990000, suggestedMax: 1060000. The line shows the 5% move clearly. But if the same chart is used to compare against another series, the truncated range can make a 5% move look like a 70% move. Use a zero-baseline inset or a small multiple for magnitude.

Log scales: equal visual distances are equal ratios, not equal differences. A log axis from 1 to 1,000,000 makes 1→10 and 100,000→1,000,000 the same distance. It cannot show zero. Use it for orders of magnitude, label it, and never mix with a linear series on the same axis.

Dual axes: two y-scales let you align any two series. That is the failure mode. A 5% rise in one and a 5% fall in another can be made to look correlated by choosing ranges. Prefer indexed views (both = 100 at t0) or small multiples. If you must use dual axes, state the ranges and test whether the correlation survives swapping the axes.

Normalized/indexed/cumulative: indexed to 100 at a baseline makes different units comparable; cumulative hides rate changes, so pair it with a per-period delta. Normalized to percentage of total makes the denominator explicit.

Decision flow: 1) What question? magnitude -> zero baseline bars. 2) change -> focused line, labeled. 3) ratios -> log. 4) different units -> index or small multiples; dual axis only with justification. 5) Always show units, transformation, bounds, ticks, and reference values.

Failure modes to name: truncated bar baseline (overestimates differences), log axis with zero (undefined), dual axis with arbitrary ranges (spurious correlation), cumulative without delta (hides slowdowns). Detect by asking ratio estimates, swapping axes, or plotting the same data as a table.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-11

Present two measures with different units honestly.

Answer

Assume the two measures share a clock and someone wants to know whether they move together. The honest default is not a dual axis: it's two stacked panels sharing the x axis, or a scatter of one against the other. Reach for a dual axis only when the two series are physically coupled and you can state the transform you applied to each.

Why the dual axis lies. Each axis is an independent affine map from data to pixels: y_px = a·value + b, with a and b free per axis. Two free parameters per series means you can pick ranges that make any two series look locked in step. Pearson's r is invariant to those transforms; the eye isn't: it reads vertical displacement, not correlation. Truncate the right axis to 150–250 ms and a 20 ms wiggle (180→200) fills 20% of the plot height. On a 0–1000 ms axis the same wiggle fills 2%. Same data, ten times the apparent drama.

Worked example. Four days of requests/s and p99 ms:

dayrpsp99 ms
120080
2400200
3300120
4500210

Index both to day 1 = 100: rps 100, 200, 150, 250; p99 100, 250, 150, 262.5. Day-4 gap = 12.5 points. Re-index to day 2, the peak: rps 50, 100, 75, 125; p99 40, 100, 60, 105. Day-4 gap = 20 points. Nothing about the data changed; the baseline did. That is why an indexed view names its baseline in the title, not the caption.

Choosing between them.

viewanswerswrong when
small multiples, shared xshape and timingyou need exact crossing values
indexed to a stated baselinerelative growthabsolute magnitude matters
scatterrelationship, correlationtime ordering matters
dual axiscoupled units, one causal storyaxes can be retuned to flatter a narrative

Failure modes. (1) Manufactured co-movement: low r, high visual lockstep. Detect by computing r on the raw series and comparing it to the chart's impression; if they disagree, the axes are doing the work. Cost: an on-call engineer rolls back a deploy that wasn't the cause. (2) Baseline shopping: re-indexing to the peak flips which series "led". Detect by rendering two baselines side by side. (3) Unlabeled units: two lines, one legend, no unit on either axis. Detect by asking a reader to state each series' unit without the legend.

If you do ship a dual axis: color-match each axis to its line, put the unit in the axis title, label the series at the line end, and print the axis min and max. Ship the underlying table too: it is the accessible fallback and the thing people screenshot when they argue.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-2

Design an executive KPI card without hiding nuance.

Answer

What I'd say first

Assume a web dashboard, an exec audience, a metric served from a governed semantic layer, and a refresh cadence the card can read. The card's job is to make the number falsifiable in five seconds: a reader should be able to tell what was measured, over what window, against what, over which slice, and how fresh it is. If any of those is missing, the card asserts more than the data supports: that is the nuance-hiding, not the font size.

The card (illustrative figures)

Net Revenue (GAAP, metric v4.2)
$4.82M   MTD, Mar 1-18 2026, America/New_York
+6.9%    vs. prior month, same day-of-month (Mar 1-18)
94.5% of pace to $5.10M MTD target
Scope: all regions - excludes intercompany - filter: Product = Platform
Data through Mar 18 13:47 ET (13 min ago) - PROVISIONAL
2 of 41 source tables late (billing_events, refunds) -> +/-$60K

Why each element is there

Definition link: "Net Revenue" means different things to finance and to the growth team; the link pins the governed version (v4.2) so a definition change is visible rather than silent.

Window and timezone: MTD in New York is not MTD in UTC, and the last day is partial. Without the window, a reader compares a partial period to a full one.

Comparison basis: "prior month, same day-of-month" is the honest comparison for a partial period. Comparing Mar 1-18 to all of February manufactures a fake decline.

Target as pace, not absolute: 94.5% of pace tells the reader whether the run rate lands, which an absolute target number cannot on day 18.

Scope and filter chips: a leftover filter from a previous session is the most common way an exec reads the wrong number. Showing the active slice makes it self-correcting.

Freshness and provisional flag: the timestamp plus the late-table count converts "this might be wrong" into a bounded, checkable claim.

Alternatives

ElementUse whenSkip when
Delta vs prior periodPeriod is complete or same-day-alignedComparison basis isn't comparable
Sparkline (13 weeks)Trend shape matters more than the pointFewer than ~8 points, or definition changed mid-window
Target barTarget is a pace or a rangeTarget is a hard commitment with its own page
Percentile bandDistribution is skewed (latency, deal size)Metric is a sum/count where the mean is the point

Failure modes

Staleness: an upstream job fails and the card keeps serving yesterday's value with no error. Detect with the freshness timestamp plus row-count/volume checks against the prior load; cost is an exec making a call on a 13-hour-old number.

Definition break: finance reclassifies refunds mid-quarter, the metric version bumps, and the trend line shows a 12% jump that is accounting, not demand. Detect by pinning the metric version and flagging any change inside the displayed window.

Comparison mismatch: a 31-day month compared to a 30-day month, or a partial period against a full one. Detect by labelling the basis and refusing to render a delta when the bases differ.

Scope drift: a saved filter persists across sessions. Detect by rendering active filters as chips with a clear-all; cost is a decision made on a subset presented as the whole.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-8

Build an information hierarchy with progressive disclosure.

Answer

Assumptions. I'll take this as an operational dashboard for one service, read daily by on-call engineers and weekly by a product review. Two audiences, one dataset. If your audience is a single expert staring at a frozen eight-metric set, the answer changes, and I say how at the end.

The answer: three layers, each answering one question, each with a defined entry and return path.

L0 answers is anything wrong right now? SLO burn rate, error rate, p99 against target, open incidents. Six tiles, one screen, no scrolling. L1 answers which component, and since when? Per-endpoint latency, saturation, deploy markers, error breakdown by class. One click from L0. L2 answers what exactly happened? Traces, logs, raw series, metric definitions. Linked out, not embedded.

That is Shneiderman's overview-first, zoom-and-filter, details-on-demand, and the same shape Nielsen described as progressive disclosure in 2006.

Why it works. Working memory holds roughly four chunks (Cowan's 2001 review), so a 40-tile wall isn't scanned, it's skimmed and abandoned. Choice reaction time also grows with the number of options (Hick, 1952), so every added tile costs the reader before they've read it. Layering turns one big decision into a sequence of small ones, and each layer's answer becomes the next layer's filter.

Trade-offs.

A flat layout wins when the metric set is small and stable and the audience is expert: nothing is hidden, nothing needs discovering, side-by-side comparison is free. It loses past roughly 20 tiles, where scan time dominates and nothing stands out.

Progressive disclosure's real cost is discoverability. A metric behind a click is a metric someone will not find. Mitigate with visible affordances: label the control with what's behind it ("18 more endpoints"), show counts, and never hide a signal that must trigger action without a click. SLO burn and active incidents stay at L0 permanently.

Don't hide data users must compare across many entities. You can't compare what you can't see side by side, so a table of 30 services belongs on one scrollable L1 view, not behind 30 clicks.

Failure modes.

Buried metric. Something that only exists at L2 never gets seen. Detect by logging drill-down opens per tile; a tile with near-zero opens that matters is misplaced.

Drill-down dead end. No return path, filter state lost on back. Detect via back-button and rage-click analytics, and time spent on L2.

Unfound second layer. The affordance is invisible. Detect via click-through rate on the "more" control; if it's a few percent, the control is the problem, not the data.

Context loss on deep link. A shared L2 link opens with no L0 context. Detect via support tickets; fix by rendering breadcrumb and parent state from the URL.

Worked trace (illustrative figures).

02:14, on-call opens L0: p99 180 ms against a 40 ms target, burn rate 14x. Clicks the latency tile. L1 shows checkout at 620 ms, everything else normal, deploy marker 6 minutes earlier. Clicks checkout. L2 trace shows 540 ms of that is connection-pool wait. Breadcrumb returns to L1 with the endpoint filter still applied.

Scan arithmetic: 6 L0 tiles at ~1.5 s each is a 9 s scan. The same 40 metrics flat is a 60 s scan, and the reader still has to find the one that moved.

What would change this. A weekly review with a frozen eight-metric set should be flat: no discovery cost, no layers to learn. A rotating audience, or a metric set that grows past ~20, should be layered. If one dashboard serves both, split it rather than compromising.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-24

Design small multiples for segment comparison.

Answer

Core answer (first 90 seconds)

First I'd pin down the comparison task, because it decides the scale. There are two different jobs: "which segment is highest right now" (ranking) and "does this segment's shape differ from the others" (pattern). Both want small multiples over overlaid lines, but ranking needs a shared scale, while pattern can tolerate free scales when magnitudes differ wildly.

Assumptions I'd state out loud: one metric with one definition across every segment, a fixed time window, and a segment count in the 6-16 range. With 3 segments, overlaid lines are fine. Small multiples earn their space past about 5 series, where legend lookup and overplotting start to dominate.

Then: same mark, same y-scale, same reference lines, direct labels on each panel, and panels ordered by the value that matters.

Why shared scales

Position on a common axis is the most accurate visual channel we have. Cleveland and McGill's ranking of elementary perceptual tasks puts position on an aligned scale above length, angle, area and color. Small multiples work because every panel reuses the same axis, so a reader compares a point in panel 3 to a point in panel 7 by eye without decoding anything. Overlaid lines break that: past ~5 series you're matching colors to a legend, which is the least accurate channel, and the lines overplot.

The scale trade-off

Shared scale is the default. Free scales are right only when segments differ by orders of magnitude, one segment at 5 ms p99 and another at 5000 ms, where a shared axis flattens the small ones into a straight line and you lose the within-panel shape. The deciding rule: if the question is cross-segment ("who's worse"), share the scale; if it's within-segment ("did this one change shape"), free scales are defensible, but then label the axis on every panel and never mix the two silently.

Panel count arithmetic

On a 1440px dashboard, 3 columns with 24px gutters gives ~450px per panel; 4 rows is 12 panels at ~450x220px, which still fits a y-axis and a couple of ticks. Past ~16 panels the ticks stop being legible and you're better off with a ranked bar chart plus a drill-down.

Failure modes

  • Free scales applied silently. A segment looks like it's spiking when its whole range is 2%. Detect by checking the y-max per panel; if they differ, cross-panel comparison is invalid. Cost: an on-call pages on a blip.
  • Denominator drift. A rate on 50 requests vs 50,000: the small segment swings 0-100%. Detect by printing n per panel or greying panels under a threshold.
  • Missing data drawn as zero. A gap reads as a drop. Render gaps as gaps.
  • Unstable panel order across refreshes. Users lose the segment they were tracking. Sort on a stable key.

Artefact

Python
fig, axes = plt.subplots(4, 3, sharey=True, figsize=(15, 8))
for ax, (name, df) in zip(axes.flat, segments):
    ax.plot(df.t, df.v)
    ax.set_title(name, loc="left")
    ax.axhline(slo, color="grey", lw=1)

sharey=True is the whole point: it's what makes the panels comparable. Drop it and you've built 12 unrelated charts.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-18

A dashboard shows a weekly metric with no context. How do you add reference lines and benchmarks so a viewer can tell whether the value is good, bad, or just different?

Answer

Start by naming the decision the panel supports, because a reference line is a claim about what normal or good means. Four references answer four different questions: a goal or target answers "are we on plan?"; the prior period answers "are we improving?"; a peer or benchmark answers "are we normal?"; a control limit answers "is this signal or noise?". Pick the one the panel is actually asking and put at most two on a chart. If you need three, you want small multiples or a delta-to-target view, not a busier plot.

ReferenceQuestion it answersSourceMisuse
Goal / targetAre we on plan?Committed plan, budget, SLADrawn as if it were a statistical limit, so a miss inside normal variation is reported as failure
Prior periodAre we improving?Same metric, prior week/month/yearSeasonal metric compared to the wrong period; WoW read as trend
Peer / benchmarkAre we normal?Peer median, industry surveyMedian hides spread; a 0.1pp gap read as a ranking
Control limitIs this signal or noise?Mean ± 3σ of a stable baselineComputed from six points, or from a baseline that already contains the shift

Placement and labeling: draw the reference behind the marks, one pixel, and keep gridlines lighter than it. Gridlines are chrome, the reference is content. Direct-label at the right end of the line with what it is and its period: "Target 4.0% (FY25 plan)", "Peer median, 2024 survey". Never a legend entry; a legend forces the eye off the line. Pick one dash convention and hold it: dashed for a target, solid for a center line, dashed for limits. Label once per line, not per point.

The trap is implying a threshold the data does not support. A target is a commitment someone made; a control limit is computed from observed variation. Drawing a target as if it were a spec limit turns a normal week into a failure. Peer medians are descriptive: without a spread or interval, a 0.1pp gap is not a ranking.

Worked check. 26 weeks of weekly conversion, mean 3.2%, sample σ 0.4pp → center 3.2%, UCL 4.4%, LCL 2.0%. Target 4.0%. This week 4.6% is above the UCL and above target: a signal worth investigating. Last week 4.1% beat target but sits inside the limits: report it as "at plan, within normal variation", not as a win. A week at 1.9% is below both: investigate. Do not draw limits from fewer than roughly 20 points, or from a baseline that already contains the shift you are looking for; recompute as the baseline grows and show the date the limits were last set.

If the value carries an interval, compare intervals, not points: a value whose interval overlaps the target is not a miss.

Vega-Lite layer for the target rule and its label:

{"layer": [ {"mark": "line", "encoding": {"x": {"field": "week", "type": "temporal"}, "y": {"field": "rate", "type": "quantitative"}}}, {"mark": {"type": "rule", "strokeDash": [4, 4], "color": "#6b7280"}, "encoding": {"y": {"datum": 4.0}}}, {"mark": {"type": "text", "align": "right", "dy": -6}, "encoding": {"y": {"datum": 4.0}, "text": {"value": "Target 4.0%"}}} ]}

Accessibility: WCAG 1.4.1. Dash pattern plus a text label, never color alone, to separate target from limit; 1.4.11 wants 3:1 non-text contrast for the line and its label against the background.

Failure modes to watch: limits recomputed after a shift absorb the signal they were meant to catch; a peer benchmark drawn from a different population than the metric; a target left on the chart after the metric definition changed. Detect them by tracking how often the line is crossed: a reference crossed every period is too tight to inform, one never crossed is decoration.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Communicate data freshness and reporting cutoffs.

Answer

I'd assume a dashboard used by on-call engineers and analysts, with data from a warehouse and a streaming pipeline. The dashboard refreshes every minute. I'd show three timestamps: event time, load time, and next expected update. I'd compute staleness as now minus event time, not job status. I'd set thresholds by decision:

DecisionMax stalenessAction
Incident response15 minAlert on-call
Daily reporting24 hBadge yellow
Weekly reporting7 dBadge red

I'd render in UTC with a timezone label. I'd alert when staleness exceeds 2x cadence.

The mechanism matters because a dashboard that only shows the last successful refresh time will show green if the last refresh succeeded, even if the data is from yesterday. The green status is tied to the job's success, not the data's recency. If the job runs daily at 02:00 UTC and fails at 02:00 today, the dashboard still shows green from yesterday's success until the next run. The fix is to compute staleness as now minus max(event_time) and compare to a threshold.

In a dbt + Snowflake stack, dbt source freshness writes max_loaded_at and snapshot_get_time to sources.json. The dashboard reads that and shows "Data through 2024-06-01 14:00 UTC, loaded 14:05 UTC, next expected 14:15 UTC". For Kafka, I'd use consumer lag from kafka-consumer-groups --bootstrap-server localhost:9092 --describe --group my-group. For Prometheus, I'd expose a last_event_timestamp_seconds gauge and alert on time() - last_event_timestamp_seconds > 900. For Grafana, I'd set the refresh interval to 1m and use a Stat panel with thresholds.

A freshness SLA is a contract: "data is no older than 15 minutes". A staleness badge is a UI element: "data is 3 hours old". A blocking cutoff prevents queries on stale data. Trade-off: blocking cutoffs are safe but can block legitimate work; badges are informative but can be ignored. Deciding criteria: if a wrong decision costs more than a delayed decision, block; if the user can judge, badge.

Failure modes: Stale green. A daily batch job fails silently; the dashboard shows green because the last run succeeded. Detection: alert on now() - max(event_time) > 2 * cadence. Cost: on-call engineers trust the dashboard and miss a customer-impacting issue for 24 hours. Timezone confusion. If the dashboard shows "last updated 14:00" without timezone, a user in IST might think it's 14:00 IST when it's UTC. Detection: enforce UTC in the API and render with a timezone label. Cost: mis-timed incident response. Partial refresh. A backfill writes half the partitions; the dashboard shows the latest partition time but not coverage. Detection: show min and max partition times and count of partitions. Cost: analysts run reports on incomplete data.

Worked example. Suppose a pipeline runs every 15 minutes. At 14:20 UTC, the last event time is 14:00 UTC. Staleness is 20 minutes. That's 1.33x cadence. If the threshold is 2x cadence (30 minutes), status is fresh. If the job failed at 14:15, the last event time is still 14:00, staleness grows to 30 minutes at 14:30, then alert.

Here's the SQL I'd use in BigQuery to compute staleness:

SQL
SELECT
  MAX(event_time) AS max_event_time,
  CURRENT_TIMESTAMP() AS now,
  TIMESTAMP_DIFF(CURRENT_TIMESTAMP(), MAX(event_time), MINUTE) AS staleness_minutes
FROM events;

And the dbt source freshness config:

YAML
freshness:
  warn_after: {count: 15, period: minute}
  error_after: {count: 30, period: minute}

I'd link to the incident ticket if there's an open incident, and to the lineage graph if the user needs to trace upstream.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-25

How do you annotate a dashboard timeline so a viewer can tell a real anomaly from a known release, outage, or campaign, and know which causes are confirmed versus suspected?

Answer

An annotation is a causal claim pinned to a timestamp, so treat it as data with an owner, a source, a confidence level and an expiry, not as a sticky note on the chart. In the first minute I'd say: only events that are verifiable, time-bounded and materially explain a visible change in the series earn a marker. A release, a confirmed outage, a campaign start or end, a pricing change, a schema migration. A Slack rumour, a competitor's blog post, or "might be related" stays out, or enters as suspected with a visibly different treatment.

Store annotations in a table keyed by metric and dimension, with start and end timestamps, not hardcoded into the chart config. Then they survive window changes, can be filtered per audience, and can be audited.

fieldexamplewhy
idrel-2025-04-12stable key
metric_scoperevenue, orderswhich series it explains
start / end2025-04-12T14:00Z / 2025-04-12T18:00Zduration, not just a point
kindrelease / outage / campaign / externalgrouping
confidenceconfirmed / suspecteddrives visual treatment
sourcedeploy log #4821auditability
ownerpayments-oncallwho retires it
expires2025-07-01stops stale labels

Placement: draw a vertical rule at the start and a shaded band for the duration, anchored to the time axis, not a floating callout box over the data. Put the label at the top of the plot area, abbreviated, with the full text in the tooltip and in an accessible table beneath the chart. Never place a label over the peak or trough you are explaining: that is the one pixel the viewer needs.

Confirmed versus suspected must not rely on colour alone (WCAG 2.2 SC 1.4.1 Use of Color). Use shape and text: solid rule plus filled marker plus "Confirmed: deploy 4.2.1", against dashed rule plus hollow marker plus "Suspected: CDN incident (unverified)".

Worked trace: revenue, 5-minute buckets:

timerevenueannotationtreatment
14:001,240deploy 4.2.1 startssolid rule, confirmed
14:05410——
14:351,180deploy rolled backsolid rule, confirmed
15:101,220CDN latency spikedashed rule, suspected

The viewer reads a 67% drop inside the deploy window, recovery on rollback, and a separate unverified blip. That is a hypothesis, not a conclusion: the annotation says what happened, the chart says what the metric did.

Keeping current: give every annotation an expiry and a review cadence. When the dashboard window moves past the event, either drop it or roll it into a monthly event strip. A 2023 campaign label sitting on a 2025 spike teaches the viewer to distrust every label on the page.

Vega-Lite layer, rule marks anchored to the time axis:

{"layer": [ {"mark": "line", "encoding": {"x": {"field": "t", "type": "temporal"}, "y": {"field": "revenue", "type": "quantitative"}}}, {"mark": {"type": "rule", "strokeDash": [4, 2]}, "encoding": {"x": {"field": "start", "type": "temporal"}, "tooltip": [{"field": "label"}, {"field": "confidence"}]}} ]}

Failure modes: annotation drift, where a label no longer matches the metric definition after a pipeline change; over-annotation, where more than roughly five markers in a 30-day window turns the chart into a timeline of excuses; and colour-only confidence encoding, which fails for colour-blind viewers and in greyscale print.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-13

Visualize uncertainty and provisional data responsibly.

Answer

Clarify first. What decision does this chart feed, and what does being wrong cost? If the decision is a threshold: "do we hit 4% conversion this week?": the interval only matters when it straddles the threshold. If the decision is a trend, the revision history matters more than the band. I'd state three assumptions up front: the metric is a proportion estimated from a sample, the series is revised for about four weeks, and the forecast is a random walk with drift.

Why bands widen. For a random walk, variance accumulates linearly in horizon, so the 80% half-width grows with √h. With daily σ = 2% of revenue, a 30-day 80% band is 1.28 × 2% × √30 ≈ 14%. The band is wide because errors add, not because the model is bad. Narrowing it by fiat is the failure, not the width.

Why a small lift is noise. The 95% CI half-width for a proportion is 1.96·√(p(1−p)/n). At p = 4%, n = 2,500: √(0.04 × 0.96 / 2500) = 0.0039, so ±0.77pp. A 0.3pp week-over-week lift sits inside that. Rendering it as a green arrow is a false claim, not a design choice.

Why the right edge lies. Provisional values move, and they move downward more often than up. A revision triangle (hypothetical figures):

weekinitial+1 wk+4 wk
W14.10%3.92%3.88%
W24.35%4.11%4.05%
W34.02%3.99%—

Initial values run ~0.2pp high and the newest point is the most inflated. So a symmetric band around the last point is wrong: either mark it provisional and withhold the band, or draw it asymmetric.

Trade-offs. Bands assume a distribution; when the risk is a regime change (pricing, an outage, a policy shift) show two or three named scenarios instead, because a band understates tail risk. Suppress the interval when the decision is a hard threshold the interval clearly clears; the band is noise there. Show it when the interval crosses the threshold, because that crossing is the deciding fact. And keep the vocabulary straight: "95% confidence" describes the coverage of the procedure, "95% credible" describes the posterior for the parameter. Mixing them in a tooltip is a real bug, not a wording preference.

Failure modes and how to catch them.

  • Band coverage drift. Count how often actuals land inside the 80% band; it should be ~80%. If it's 55%, the band is too narrow: usually because it ignores correlated error across segments.
  • Summed intervals. Adding independent segment CIs understates the total. Detect it by computing the CI on the aggregate and comparing the two.
  • Revision shock. Track the |revision| distribution and alert when a week revises more than 2× the trailing median. The cost is concrete: staffing decided on a provisional 4.35% that settles at 4.05%.
  • False precision. A model output shown as 3.47% when its error is ±2pp. Round to one significant digit of the error.

Label provisional points, keep raw and adjusted series side by side, and before anyone acts, ask them to state both the central estimate and the plausible range out loud.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

Create an accessible and semantically consistent color system.

Answer

Assumptions: a web product, CSS custom properties, light and dark themes, WCAG 2.2 AA (W3C Recommendation, October 2023) as the contract, and status information that is also written in text.

Three layers, only the top one carrying meaning. Primitives are named by appearance and never referenced by product code. Semantic tokens are named by role and are the only thing components reference. A theme is a second mapping from semantic to primitive, not a second palette.

layerexamplemay be referenced by
primitiveblue.600 = #0B57D0the semantic layer only
semanticcolor.action.primary.background -> blue.600 in light, blue.400 in darkcomponent styles
component.btn-primary { background: var(--color-action-primary-background) }nothing

This is what makes the system semantically consistent: color.status.critical survives a rebrand, color.red does not. Primitives are the deliberate exception -- appearance names are safe there precisely because nothing may depend on them. Ship DTCG-format JSON compiled by Style Dictionary once there is more than one platform or theme.

Accessibility then attaches to the semantic layer as numbers, per theme, on resolved values:

semantic pairlightdarkgate
text.default on bg.surfacegrey.900 #1F1F1F on #FFFFFF = 16.5:1grey.100 #F2F2F2 on #121212 = 16.7:1>= 4.5:1 (SC 1.4.3; 3:1 above 18pt or 14pt bold)
border.focus on bg.surfaceblue.600 #0B57D0 on #FFFFFF = 6.4:1blue.200 #8AB4F8 on #121212 = 8.9:1>= 3:1 (SC 1.4.11)

Now the mechanism behind perceptual ordering, because it is not a style preference. HSL lightness is not perceptual lightness: hsl(60 100% 50%) is #FFFF00, relative luminance 0.9278, which is 1.07:1 against white; hsl(240 100% 50%) is #0000FF, luminance 0.0722, which is 8.59:1. Identical HSL L, eight times the contrast. A palette picked by eye in HSL can therefore hold swatches that are unusable as text or as a 3:1 border while all looking equally light. Build ramps in OKLCH or CIELAB instead: fix the hue, step L in even increments, and drop chroma as L nears 0 or 1 or the colour leaves sRGB. Rainbow scales fail for the same cause -- jet peaks at yellow and dips at blue, so luminance is non-monotonic, equal data steps look unequal, and the yellow and cyan bands read as boundaries that are not in the data. Ordered data gets viridis (matplotlib default since 2.0), Cividis, or Crameri's batlow; diverging data gets two hues with a neutral midpoint; categorical hues top out around six to eight before labels beat colours.

The gate is a test, not a review habit:

TypeScript
// contrast.ts -- TypeScript 5.4 / Node 20
const lin = (v: number) => {
  const s = v / 255;
  return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
};
const lum = (hex: string) => {
  const n = parseInt(hex.slice(1), 16);
  return 0.2126 * lin((n >> 16) & 255) + 0.7152 * lin((n >> 8) & 255) + 0.0722 * lin(n & 255);
};
export const ratio = (a: string, b: string) => {
  const [hi, lo] = [lum(a), lum(b)].sort((x, y) => y - x);
  return (hi + 0.05) / (lo + 0.05);
};

for (const [theme, t] of Object.entries(themes))
  for (const [fg, bg] of textPairs)
    if (ratio(t[fg], t[bg]) < 4.5)
      throw new Error(theme + ': ' + fg + ' on ' + bg + ' = ' + ratio(t[fg], t[bg]).toFixed(2) + ':1');

Traced: ratio('#767676', '#FFFFFF') gives lum 0.1812, then 1.05 / 0.2312 = 4.54. ratio('#777777', '#FFFFFF') gives 0.1845, then 1.05 / 0.2345 = 4.48. #767676 is the lightest grey that passes on white; one hex step above it fails.

Trade-offs. Token indirection costs a build step and a JSON file, and pays for itself at the second theme or platform, where a theme switch becomes a mapping edit rather than a component sweep. WCAG 2.2's 4.5:1 is what an audit cites; APCA is the WCAG 3 candidate, models thin fonts and dark mode better, but is required by nothing yet and disagrees with 4.5:1 near the boundary, so it is not a CI gate. A fixed red/amber/green status set reads fastest, while distinct shapes or icons cost screen space and design time and remove the colour-only dependency.

Failure modes, with detection:

  • Colour-only status. Deuteranopia collapses the red-green axis, so two statuses close in luminance become one swatch. Detect with Rendering -> Emulate vision deficiencies -> Deuteranopia in Chrome DevTools, plus a greyscale print. Red-green deficiency affects roughly 8% of men and 0.5% of women; deuteranomaly alone about 5% of men.
  • Dark-theme regression. An elevated #2A2A2A card on a #121212 page is 1.30:1 -- no visible boundary -- and box-shadow elevation disappears entirely in forced-colors mode. Detect with the loop above across every text/surface pair in every theme, plus a forced-colors smoke test.
  • One focus colour on a coloured control. #0B57D0 on a #0B57D0 button is 1:1. Detect by screenshotting focus states on every surface token; fix with a two-tone ring so one band always contrasts.
  • Token drift. A hex literal in component CSS bypasses every gate. Detect with stylelint color-no-hex in component directories, permitted only in the token source.

What would change this: one theme, one platform, no status UI -- drop the semantic layer and keep the contrast test.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-7

Design dashboard visual accessibility end to end.

Answer

The 90-second answer. A dashboard is accessible when a screen reader user gets the same three things a sighted user gets from each chart (what it shows, what changed, and what the outlier is) and can operate every filter without a mouse. I'd assume WCAG 2.2 AA as the bar, a component library we control, and charts rendered as SVG or canvas rather than flat images. Then I'd enforce it at four points in the lifecycle: design tokens, the chart component contract, CI, and a manual audit per release.

Why the mechanism matters. A chart is not one accessible object. Put role="img" and an aria-label on an SVG and the accessibility tree exposes a single leaf node: every child is hidden. So the label is all a screen reader gets, and the data underneath is gone. That's why the label has to carry the finding, not the axis names: "Revenue by region, Q1–Q4; EMEA flat, APAC up 40% in Q4" beats "Bar chart of revenue." If the numbers matter, they have to live outside the graphic, in a real <table> with <caption> and <th scope="col">, or in a text summary referenced by aria-describedby.

Canvas is worse. Chart.js and D3-canvas render to a bitmap with no accessibility tree at all: Chrome DevTools' accessibility pane shows an empty subtree. The fix is the same table plus a summary and a "download CSV" link.

Trace: what NVDA actually says. Filter to "Q4", the chart re-renders, and the app sets aria-live="polite" on a status node. NVDA finishes the current utterance, then reads "Showing 12 of 48 regions, Q4." With assertive instead, it interrupts mid-word, and if the filter fires on every keystroke, 20 updates queue and the user hears a stutter of fragments. Debounce to roughly 300 ms, use polite for results, assertive only for errors.

Thresholds I'd hold the design system to.

WCAG 2.2Dashboard elementValue
1.4.3Body text, axis labels4.5:1
1.4.3Large text ≥18pt / 14pt bold3:1
1.4.11Chart strokes, focus ring, borders3:1
2.5.8 (AA)Filter buttons, legend toggles24×24 CSS px
2.5.5 (AAA)Touch targets on mobile44×44 CSS px
1.4.10Reflow at 320 CSS px (=400% at 1280)no 2-D scroll

Trade-offs. Table versus long description: a table wins up to roughly 50 rows because it supports comparison and sorting; past that, a summary plus a CSV download beats a 500-row table nobody can navigate. SVG versus canvas: SVG stays in the accessibility tree and scales cleanly, but a 10k-point scatter becomes 10k DOM nodes; canvas is faster and needs the table to carry everything. Live region politeness: polite may be delayed behind other speech, assertive is immediate and rude. Pick per message class, not per app.

Failure modes and how you catch them.

  • Color-only encoding (red/green for up/down) fails 1.4.1. Roughly 8% of men have red-green deficiency. Detect: grayscale the screenshot, or run a deuteranopia simulator.
  • CSS order or grid-area reorders visually but not in the DOM; NVDA reads the old sequence. Detect: tab through and compare against the visual order. No automated tool catches this.
  • Hover-only tooltips fail 1.4.13. Detect: keyboard-only pass; if the value is unreachable by Tab, it's a fail.
  • Focus lost on drill-down re-render. Detect: after activating a drill, check document.activeElement is still in the DOM.
  • axe-core in CI catches the machine-checkable subset (contrast, names, roles, labels) and misses meaning. Budget a manual NVDA plus keyboard pass per release.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-12

Design an accessible analytical table.

Answer

Core answer

Assume a read-mostly analytical table: 10k–1M rows, columns mixing text, currency, percentages and a status, users on keyboard and screen readers, and some rows outside the viewer's authorization scope.

Start with a native <table>. It gives screen readers row/column association for free: a cell is announced as "Revenue, Q3 2024, 1,204". Reach for role="grid" only when cells become interactive (editing, selection, roving focus), because that pattern makes you manage focus and ARIA indices by hand.

HTML
<table aria-rowcount="1204">
  <caption>Q3 revenue by region (USD, thousands)</caption>
  <thead>
    <tr>
      <th scope="col">Region</th>
      <th scope="col" aria-sort="descending">Revenue</th>
      <th scope="col">Margin</th>
    </tr>
  </thead>
  <tbody>
    <tr aria-rowindex="2">
      <th scope="row">EMEA</th>
      <td>1,204</td>
      <td>31%</td>
    </tr>
  </tbody>
</table>

<caption> is the accessible name. scope="col" and scope="row" wire the associations. aria-sort on the sorted header tells the screen reader the current order; update it on every sort and keep it on exactly one header. aria-rowcount is the total data rows, not the DOM rows: that is what makes virtualization honest.

Pagination vs virtualization

PaginationVirtualization
DOMevery row on the page presentonly visible rows present
Ctrl+F / browser findworksbroken: off-screen rows aren't in the DOM
Screen reader virtual cursorreads the whole pagereads only rendered rows
ARIA costnonemust set aria-rowcount + aria-rowindex
100k rowsfinefine

Deciding criterion: if users verify by searching the page or read linearly with a screen reader, paginate. If they scan and sort a huge set and never read it end to end, virtualize, and pay the ARIA index cost.

Failure modes

  • Virtualized grid without aria-rowcount/aria-rowindex: the screen reader announces "row 1 of 1" for every row. Detect by running NVDA or JAWS over the grid.
  • Sort state not announced: sighted users see the arrow, screen reader users don't know the order. Fix with aria-sort plus a polite live region: "Sorted by Revenue, descending, 1,204 rows."
  • Authorization done in CSS: rows shipped to the client and hidden with display:none are still in the payload. Filter server-side; a column the user can't see should never be sent.
  • Totals on non-additive columns: summing a margin column is meaningless. Total only additive columns, in <tfoot> with scope="row".

Missing vs suppressed

These mean different things. Missing = no data exists; render an em dash with a visually hidden "no data". Suppressed = data exists but is withheld (privacy, small-cell rule); render "suppressed" with distinct styling and a tooltip explaining why. Collapsing both to ": " makes an analyst read a privacy rule as a data gap.

Responsive

Don't collapse to cards: that severs header association. Let the table scroll horizontally inside a focusable region (role="region", tabindex="0", aria-label="Revenue table, scrollable") so keyboard users can reach the scrollbar, and offer a column picker. Right-align numbers and set font-variant-numeric: tabular-nums so digits line up.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Design loading, empty, stale, partial, and error states.

Answer

Assumptions. Ops dashboard, ~24 independent tiles, each tile one query: Prometheus for metrics, BigQuery for logs. The user is on-call. Scrape interval 30s, so the freshness SLA is 60s. Tiles fetch independently; there is no page-level load.

Core answer. These are not five visual styles. They are five answers to one question: can I trust this number right now? Derive the state from the fetch lifecycle plus a freshness check. Never from the value. The bug that pages someone at 3am is a tile rendering 0 because the query failed, not because traffic stopped.

StateTriggerShowNever show
Loadingfirst fetch in flight, nothing cachedskeleton at final layout size, aria-busy="true"0, -, or a spinner that shifts layout
Emptyfetch succeeded, result set genuinely emptythe filter that produced it: "0 rows for service=checkout, env=prod, last 1h"a blank panel
Partialsome series returned, others errored or timed outcoverage: "3 of 5 regions; us-east-1 missing since 14:02"a line interpolated across the gap
Stalecached data older than the 60s SLAthe value, dimmed, with "as of 14:03:12"stale data presented as current
Errorfetch rejected, or 5xx/timeoutimpact plus retry, correlation IDstack traces, raw query URLs

Why empty and zero collide. Prometheus instant queries use --query.lookback-delta, default 5m: a target that died four minutes ago still returns its last sample, so the tile looks alive. And a query matching nothing returns HTTP 200 with an empty vector: indistinguishable from a real zero unless you check up == 0 or a row-count sanity bound alongside it. That is the mechanism behind the bug; the fix is to make the tile ask two questions, not one.

Trade-offs. Three credible options for the loading→data transition. Skeleton: honest, no layout shift, but useless if the fetch takes 4s. Spinner: cheap, but shifts layout and says nothing about shape. Stale-while-revalidate (TanStack Query v5: staleTime defaults to 0, gcTime to 5 min): instant, but shows old numbers as if current. Deciding criterion: does the user act on the number within seconds? On-call paging → never show stale without a visible timestamp. Weekly capacity report → stale-while-revalidate is fine.

Skeletons must be per-tile, not page-level. 24 tiles over HTTP/1.1 at 6 connections per origin is 4 waves; at 800ms p99 that is 3.2s before the last tile paints, and a page-level skeleton would hide the 18 tiles that were ready at 800ms.

Failure modes. (1) Silent zero from a dead exporter: detect with up == 0 or a row-count floor; cost is a false "traffic dropped to zero" page. (2) Partial failure where 3 of 24 tiles 504: detect by counting tile states and surfacing "21/24 loaded" at the page level; cost is a user trusting an incomplete picture. (3) Thundering herd on retry: 24 tiles × 3 retries against a recovering backend. Cap retries at 2 with jittered backoff, and never retry 4xx: a malformed query fails identically every time.

Accessibility and testing. Loading uses role="status" with aria-live="polite"; errors use role="alert". WCAG 2.2 SC 4.1.3 covers status messages. Respect prefers-reduced-motion for skeleton shimmer. Test mixed states explicitly: force one tile to 504, one to empty, one to stale, and assert the page-level summary reads correctly.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

Design safe filters, cross-filtering, and drill interactions.

Answer

Core answer (say this first)

Assume a multi-tenant BI dashboard, ~10M-row fact table, embedded in a customer portal, users are non-technical. Three decisions, in order:

  1. Filter scope is explicit, not inherited. Every filter declares its scope: single visual, page, or dashboard. In Tableau that's the filter dialog's "Apply to Worksheets" (All Using This Data Source / Selected Worksheets / Single Worksheet); in Power BI it's the slicer's Sync slicers pane plus Edit Interactions. Default new filters to page scope, never dashboard: a dashboard-wide filter set by accident is the most common "why is everything blank" ticket.

  2. Cross-filter is a highlight by default, a filter on demand. Clicking a mark should dim the rest and keep axes fixed (Power BI's cross-highlight), not silently remove rows. Filtering on click destroys the comparison the user was making. Reserve true cross-filter for card/KPI tiles where there's no axis to preserve.

  3. Drill is two different things. Hierarchy drill-down (Year → Quarter → Month) keeps the current filter context and just changes grain. Drill-through (right-click → See records) opens a detail page and must carry filter context explicitly: Power BI's drill-through page has "Keep all filters" on by default; turn it off and pass only the fields you mean, or the detail page inherits a filter the user forgot about.

Why it behaves this way

A click on a mark is a selection, not a predicate. The moment you turn it into a WHERE clause, you've changed the data behind every other tile, and the user has no way to tell whether the number moved because of their click or because of a refresh. That's why the chip matters: it's the only evidence the state changed.

Trade-offs

InteractionKeeps contextFocusReversibleUse when
Cross-highlightYes (axes fixed, others dimmed)WeakClick empty spaceComparing categories
Cross-filterNoStrongChip × or resetDrilling into one segment
Drill-downYes (same filters, finer grain)MediumBreadcrumb backTime/geo hierarchy
Drill-throughNo (new page)StrongBack buttonRow-level detail

Failure modes and detection

  • Stale link. A shared URL carries ?region=EMEA after EMEA is renamed. Dashboard renders empty with no message. Detect: log renders where the result set is zero and a filter param is present; alert on the ratio.
  • Timezone off-by-one. "Last 7 days" computed in the browser's TZ vs the warehouse's UTC. A user in UTC+13 sees a different day boundary. Fix: compute relative dates server-side, pass absolute dates in the URL.
  • Authorization as UI. Hiding a filter option is not access control. Row-level security belongs in the query layer (Power BI RLS with USERPRINCIPALNAME(), Looker access_filters, Tableau user filters) and must be tested with a token that should be denied.

Server-side validation of shareable state

Python
# Python 3.12 — validate a filter param before it reaches the query
ALLOWED = {"region": {"EMEA", "AMER", "APAC"}, "year": {"2023", "2024", "2025"}}

def parse_filters(qs: dict[str, str]) -> dict[str, str]:
    out = {}
    for key, raw in qs.items():
        if key not in ALLOWED:
            continue                      # drop unknown keys, don't error
        if raw not in ALLOWED[key]:
            raise ValueError(f"{key}={raw!r} not in allowed set")
        out[key] = raw
    return out

Trace: ?region=EMEA&year=2024&debug=1 → region and year pass, debug is dropped, returns {"region": "EMEA", "year": "2024"}. ?region=LATAM → raises, and the handler renders the default view with a "filter no longer available" banner rather than an empty grid.

That's the whole thing: scope declared, highlight before filter, drill carries context explicitly, and state validated at the boundary.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-21

Plan dashboard research and usability validation.

Answer

The 90-second answer

Before I plan anything I ask what decision the dashboard is supposed to change and what the current failure looks like. If the complaint is "40% of ops staff abandon the incident view," that is a task-completion problem and I plan a task-based study. If it is "nobody trusts the numbers," that is a mental-model problem and I plan a comprehension study. The plan differs, so I pin the failure signal first.

Assuming a task-based study, the plan is: 6 participants per distinct role, moderated think-aloud, 45-minute sessions, one week to recruit and one week to run, then a second unmoderated round at 30-50 participants to confirm the fixes held.

PhaseMethodnDurationOutput
ScopingStakeholder interviews + telemetry review3-4 stakeholders3 daysTask list, success criteria
FormativeModerated think-aloud6 per role (2-3 roles)45 min eachRanked usability problems
Fix + retestPrototype iterationsame 6, re-run30 minProblem closure rate
SummativeUnmoderated task study30-5015 minSuccess rate, time-on-task

The 6-per-role figure comes from the long-standing heuristic that ~5 users in a homogeneous group surface most usability problems (Nielsen, 2000); it assumes one role and simple tasks, so I multiply by role rather than testing 5 people total. Arithmetic for a 3-role study: 18 moderated sessions × 45 min = 13.5 hours of session time; at roughly 1.5 hours of researcher time per session for setup, notes and analysis, that is ~27 hours, about 4 days for one researcher. Incentives at $100-150 per participant land at $1,800-2,700.

Tasks are realistic scenarios, not feature tours: normal status, stale data, missing data, permission-denied, and an exception. For each I measure unaided success, time-on-task, and whether the participant reached the right conclusion. I set thresholds before running: for example, ≥80% unaided success and ≤90 s median time-on-task on the primary "find the affected segment" task. Below that, the design fails and I say so.

Trade-offs. Moderated think-aloud gives the why (probing, confusion, wrong readings) but costs 10-20× per participant and realistically caps at 6-8 per group. Unmoderated scales to 50+ and yields clean success and time numbers, but you cannot ask why. So qualitative first to find problems, quantitative second to size them. When not to run research at all: if telemetry already answers it (funnel drop-off, rage clicks, time-to-first-action), read the logs first. A study costs weeks and tells you less about frequency.

Failure modes.

  • Proxy participants. Internal power users who know the schema finish in half the time and never ask what a field means. Recruit from the actual on-call rotation.
  • Fake scenarios. Participants cannot act because the data is not theirs; you hear "what am I supposed to do here?" Use their own recent incident where possible.
  • Findings that die. A ranked list with no owner or date two weeks after the readout is a dead study.
  • Accessibility tested last. Keyboard and assistive-technology users hit blockers the mouse cohort never sees. Run one AT session per round, not a separate phase.

Throughout, ask participants to say what a number means before they act on it. A wrong reading is a defect even when the click was correct.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-19

Choose and validate dashboard defaults.

Answer

Clarify before answering. "Defaults" is under-specified until you name the primary audience and the decision they open the dashboard to make. I'd ask: who opens this first. On-call, a PM, an exec? What is the one question they answer in the first ten seconds? Does everyone who can open it have access to every data source behind it?

Assume an on-call SRE dashboard for a payments API. Primary decision: is it healthy right now, and did the last deploy break it? Audience is authorized for prod metrics only.

Core answer. Set five defaults explicitly and write them into the dashboard definition, not into someone's memory:

DefaultValueWhy that value
Time rangenow-6h to nowcovers a deploy plus rollback window; short enough that a 15s scrape doesn't render 1,440 points per series
Refresh30smatches the scrape interval; faster just re-renders identical data
TimezoneUTCone anchor for every tile and every alert
Populationenv="prod", region=Allthe scope the audience is authorized for
Excluded statesstatus!="test" in a shared variable, not per tilekeeps tiles reconcilable

Why defaults drift. A dashboard default is copied, not inherited. In Grafana's dashboard JSON the top-level time object ({"from":"now-6h","to":"now"}) and timezone ("browser" by default, or "utc") set the page, but any panel can carry its own timeFrom/timeTo override. So the header says 6h, one panel says 24h, and two numbers on the same screen are over different windows. Nothing errors; the reader just compares incomparable things.

How timezone propagates. SQL panels expand $__timeFilter(ts) using the dashboard timezone, so flipping the dashboard from browser to utc changes which rows every panel selects. If the dashboard stays on browser and the viewer is in Europe/Berlin while the data is UTC, "today" means a different instant per viewer, and a daily rollup bucket keyed to local midnight shifts by an hour.

Excluded-state divergence. If the latency tile filters status!="test" and the throughput tile doesn't, throughput includes synthetic traffic and p99 doesn't. An on-call engineer chasing a throughput drop that only exists in test traffic burns the first ten minutes of an incident.

Trade-off: does personal state persist? Three options. (a) Don't persist: every load is the default; reproducible, but annoying for exploration. (b) Persist per user in browser storage: Grafana does this for time range by default; good for exploration, bad for shared links. (c) Persist only in the URL. Criterion: if a link will be pasted into an incident channel, the URL must win, because a persisted range travels with the reader and not the link. It's wrong when a stale persisted window makes the next reader think the incident is already over.

Failure modes and detection.

  • Permission change: a saved variable value points at a data source the user lost access to; the tile renders "No data", indistinguishable from a real outage. Detect with a canary panel that always returns a known constant.
  • Expired saved value: the variable holds region=us-east-2 after that region is decommissioned; the query matches nothing and the dashboard looks green. Detect by checking the saved value against the live label set and falling back to All.
  • No data: a 6h default on a service doing 3 requests/day shows an empty panel. Detect with a "requests in window" stat; zero means the range is wrong, not the service.
  • Locale: an axis reading 03/04 is March 4 or April 3 depending on the viewer.
  • Shared link: URL from/to override the default; a link that omits them hands the reader their own persisted range.

Worked trace: DST. Dashboard timezone browser, viewer in America/New_York, default range "Today". On 2024-11-03 DST ends at 02:00 local, so the day is 25 hours. A "requests today" counter reads 25/24 = 4.2% higher than a flat day; a "requests/hour" tile reads 4.2% lower. Both are correct arithmetic on the wrong window. Fix: anchor the dashboard to UTC, or use a rolling now-24h window, which has no DST discontinuity.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Walk me through how you adapt a dashboard's layout across screen sizes and devices without breaking its reading order or hiding the primary measure.

Answer

Say the primary measure out loud before you touch a breakpoint. A dashboard exists to answer one question, "is checkout erroring right now", and that element is pinned first in the DOM and never collapses, reorders, or hides behind a control. Everything else gets a rank and a collapse order.

Assumptions: a 12-column grid at ≥1024px, breakpoints at 1024/768/480, and WCAG 2.2 SC 1.4.10 Reflow as the floor. Content works at 320 CSS px (a 1280px viewport at 400% zoom) with no two-dimensional scrolling. The exception in that criterion covers content that genuinely needs two dimensions, which is where data tables and maps live; it is not a licence to scroll the whole page sideways.

Collapse order, first to go last:

region14401024768320
primary measuretop-left, 4 colsfull widthfull widthfirst, full width
trend chart8 cols8 colsfull widthfull width, 240px tall
breakdown / small multiples4 cols4 cols2×2stacked, shared scale
filterssidebartop bardrawer + chip rowdrawer + chip row
legendrightrightabove chartdirect labels
table columnsallallallhorizontal scroll inside the table only

The mechanism that keeps reading order intact is source order. Place regions with grid-template-areas, never with order or flex-direction: column-reverse; those change paint order but not DOM order, so a screen reader and the tab ring follow a different path than the eye.

css .dash { display: grid; gap: 16px; grid-template-areas: "primary" "trend" "breakdown" "filters"; } @container (min-width: 60rem) { .dash { grid-template-columns: 2fr 1fr; grid-template-areas: "primary primary" "trend breakdown" "filters filters"; } }

HTML order is primary, trend, breakdown, filters at every width.

Filters and legends. On narrow viewports filters move into a drawer, but the active state stays visible as a chip row ("region = EMEA, last 7d") because a hidden filter is how someone reads the wrong number confidently. Legends either move above the chart or are replaced by direct labels on the series; a legend that disappears leaves colour unlabelled, which fails SC 1.4.1 Use of Color. Hover tooltips have no touch equivalent, so any value reachable only on hover needs a tap target or a persistent readout.

Dense tables. Never drop columns silently: that changes the answer. Keep the identity column frozen and let the table scroll horizontally (the Reflow exception covers it), or switch each row to a labelled key/value card. Small multiples go 4-across → 2×2 → one column, and every panel keeps the same axis domain; rescaling per panel on mobile destroys the comparison the chart exists for.

Honest mobile view. Same query, same filters, same freshness timestamp, same definitions. The failure mode is a mobile variant that quietly aggregates differently, top 10 segments instead of all, so the phone shows a different number than the desktop for the same filter set. If a measure cannot be shown honestly at 320px, link to the full view instead of truncating it.

Arithmetic worth doing: at 320px with 16px page padding you have 288px of content. A four-up KPI row that is ~330px per card at 1440 stacks to four rows; at 96px each plus gaps the fourth sits ~430px down, below the fold once a 56px header and the filter chip row are counted. So the primary card goes first and the rest stack under the trend: a scroll-snap strip is tempting and fails 1.4.10 for ordinary content.

Detect the failures by tabbing through at 320px with a screen reader on, comparing mobile and desktop numbers for one filter set, and checking 400% zoom for two-dimensional scroll.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

Design dashboard variants for multiple audiences.

Answer

Assumptions I'd state first: one warehouse (Snowflake), one BI tool (Looker), three audiences. Exec, ops manager, analyst. My answer: define every metric once in a governed semantic layer, give each audience a thin presentation layer over it, and enforce authorization in the query rather than the dashboard.

Divergence comes from dashboards embedding their own SQL. If net_revenue is defined once: dbt's semantic layer (MetricFlow, dbt Core 1.6+) as sum(order_total) - sum(refund_total) filtered to status = 'complete': every surface compiles the same SQL. Exec and analyst disagree only when two teams write two SUMs.

The variant map

ExecManagerAnalyst
QuestionAre we on track?What do I fix this week?Why did it move?
GrainMonth, companyDay, own teamOrder / event
ComparisonPlan, YoYPrior week, peer teamsAny slice
Default filterNoneOwn teamNone
Drill targetManager viewOrder listRaw tables
SurfaceLooker tile, scheduled emailLooker dashboardSQL + notebook

Same metric IDs across all three; only group by, where, and drill targets differ.

Authorization. In Looker, an access_filter on the explore bound to a user attribute team_id; a Snowflake row access policy as the backstop if someone queries the table directly. Column-level: BigQuery policy tags or Looker sql_always_hide for PII. The subtle part is drill-through: it must carry the filter. Trace: exec clicks "EMEA revenue" → drill URL /explore/orders?fields=...&f[team_id]=EMEA → Looker re-applies access_filter → rows limited to EMEA. If the drill URL dropped f[team_id], the analyst-level explore behind it would return every region. That is a privilege escalation, not a UX bug.

Trade-off: one flexible dashboard vs per-audience variants. One dashboard with a role switcher is less to maintain, but every audience pays the maximum complexity and the default view is wrong for all three. Per-audience variants cost roughly 3× maintenance but keep each scan path short. Deciding criteria: if exec and manager ask the same question at different grain, one dashboard with a grain toggle wins; if the questions differ in kind (monitor vs diagnose), split. Past about four audiences, a role switcher becomes a config matrix nobody owns.

Failure modes and detection

  • Metric drift: two dashboards, two SQL definitions. Detect with a reconciliation test that compares each surface's number to the semantic layer's and alerts on a delta above 0.5%.
  • Drill leak: drill drops the row filter. Detect with an automated test that runs every drill URL as a low-privilege user and asserts the row count.
  • Hidden uncertainty: exec tile shows a single number with no sample size. Show n and a range when n falls below a threshold (say 30).
  • Staleness: exec view cached 24h, manager 1h. Print the freshness timestamp on the tile.

Hypothetical figures for sizing: a pre-aggregated exec tile at p95 0.4s, the analyst explore scanning raw at p95 6s. Different latency budgets are fine because the audiences tolerate different waits, but they must read the same number.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-14

Handle metric definition and data-pipeline changes on a dashboard.

Answer

Core answer

First question: is this a definition change, a pipeline change, or a coverage change? They need different handling. A definition change (same rows, new logic) restates history. A pipeline change (same logic, new source or new dedup) usually doesn't, but can. A coverage change (new region, new event type) adds rows and makes the series non-comparable at the boundary.

Assumption I'd state: the dashboard is a decision surface with downstream consumers (alerts, exports, a finance model) not a read-only view.

Then: version the definition so the old number stays reproducible, measure the delta over overlapping history, decide restate vs annotate on whether the old number was wrong or merely different, and put the break in the chart itself, not in a Slack message.

Version the definition

dbt model versions (dbt-core ≥1.5) give you both definitions side by side:

YAML
models:
  - name: fct_orders
    latest_version: 2
    versions:
      - v: 1
        deprecation_date: 2025-06-01
      - v: 2
        defined_in: fct_orders_v2

latest_version: 2 makes ref('fct_orders') resolve to v2; ref('fct_orders', v=1) still resolves to v1, so the old number is reproducible for audit. Before the swap, snapshot the pre-change table: Snowflake CREATE TABLE fct_orders_pre_v2 CLONE fct_orders is metadata-only and instant; BigQuery CREATE SNAPSHOT TABLE gives you a 7-day time-travel window.

Measure the delta

Run both definitions over the same window and diff. Here v2 excludes refunded orders:

SQL
select
  count(*)                                                   as orders,
  sum(case when status = 'refunded' then amount else 0 end)  as refunded_amount,
  sum(amount)                                                as rev_v1,
  sum(case when status <> 'refunded' then amount else 0 end) as rev_v2
from fct_orders
where created_at >= '2025-01-01' and created_at < '2025-04-01';

Hypothetical output: orders 412,880, refunded_amount 61,932.00, rev_v1 1,238,640.00, rev_v2 1,176,708.00. The restatement is −61,932, exactly 5.0% of Q1.

The delta is not uniform, and that's the part that bites. Refunds land ~10 days after purchase, so the last 14 days of the restated series drop 9–12% while days older than a month drop ~3%. Restating makes the recent tail look worse than it will settle at: right-censoring, not a business decline.

Restate or annotate

changeactionwhy
bug (double-count, timezone, join fan-out)restateold number is wrong; keeping it is a lie
policy (exclude refunds, change attribution window)annotate, keep bothold number was defensible; finance may have reported it
coverage (new region, new event)annotate, never restatepre-boundary rows don't exist; restating invents them

Deciding criterion: would you defend the old number to an auditor? No → restate. Yes → annotate. Restating a policy change silently rewrites history someone already published; annotating a bug fix leaves a known-wrong number on the chart forever.

Make the break visible

Grafana region annotations carry a start and end, so the shaded band covers the affected window:

POST /api/annotations
{
  "dashboardUID": "ops-revenue",
  "time": 1735689600000,
  "timeEnd": 1743465600000,
  "tags": ["metric-change", "fct_orders-v2"],
  "text": "fct_orders v2: refunded orders excluded. History restated 2025-01-01 onward; -5.0% on Q1."
}

Tableau's Data Quality Warning on the data source puts a banner on every sheet that uses it; Looker's datagroup with max_cache_age plus a tile note does the same job. The point is that the annotation lives with the chart, so a reader six months later sees it without asking.

Failure modes

  • Silent splice. The chart steps down 5% at the change date and reads as a business drop. Detect with a singular dbt test asserting rev_v1 - rev_v2 equals the expected refund sum within tolerance; without it you find out when an exec asks why revenue fell.
  • Alert baseline drift. A rev < 1.0M/day alert fires every day after restatement because the baseline moved. Detect by watching alert firing rate across the deploy; fix by re-baselining on the same window, not by muting.
  • Partial backfill. Three of five days land, the chart shows a two-day dip. Detect with per-partition row-count and freshness tests (dbt source freshness, or a not_null plus count test per day), not a whole-table check.
  • Two truths. A finance export pinned to v1 keeps emitting old numbers while the dashboard shows new. Detect via dbt exposures: dbt ls --select +exposure:finance_export lists everything that must move with the change.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Design a dashboard performance strategy.

Answer

Clarify first (30s). Who's the audience: execs scanning eight tiles, or analysts drilling to row level? What's the freshness tolerance: 15 minutes or next-day? Peak concurrent viewers, and the p95 budget? I'll assume: 200 internal users, 30 concurrent at the 9am peak, 20 tiles, a 50M-row fact table, one-hour freshness tolerance, p95 target of 2s to the first meaningful tile and 5s to full interactivity.

Core answer. Budget the load, then cut it in three places, in this order.

StageTargetWhy this number
First meaningful tile≤ 2s p95Below the point users re-click
Full dashboard interactive≤ 5s p95Above this, people abandon the view
Queries per load≤ 8Caps warehouse queue pressure
Rows scanned per query≤ 5MKeeps each query under ~0.2s

Arithmetic that drives the design: 20 tiles × 1 query × 30 concurrent users = 600 queries per refresh wave. If each scans 50M rows and takes 1.2s on a 20-slot warehouse, queue wait dominates and p95 goes from 1.2s to roughly 9s. Pre-aggregating to a daily rollup of 5M rows drops scan time to ~0.15s, so 600 queries fit the slots and p95 lands near 1s. That single change is worth more than any front-end tuning.

Trade-offs, with the deciding criterion.

  • Pre-aggregate: right when the same slice is queried repeatedly and freshness tolerance ≥ refresh cadence. Wrong when users need ad-hoc drill to row-level detail or filters outside the aggregate grain: you either serve a wrong number or fall back to the base table and pay full cost anyway. Criterion: repetition × freshness tolerance vs. ad-hoc filter cardinality. If more than ~30% of queries are ad-hoc, the rollup buys little.
  • Cache: right for shared, non-personalized slices. Wrong when row-level security differs per user: the cache key must include the auth scope or you leak. Also wrong when decisions depend on data fresher than the TTL.
  • Live pushdown: right for high-cardinality ad-hoc; wrong for repeated dashboard loads, where it just re-pays the scan cost.

Failure modes and how you'd catch them.

  • Cache keyed on filters but not auth scope → cross-tenant leak. Detect: a test asserting two users with different scopes get different rows, plus a hit rate that's implausibly high across users.
  • Rollup drift vs. base → totals don't reconcile. Detect: nightly reconciliation comparing rollup sum to base sum; alert on >0.1% drift.
  • Thundering herd at TTL expiry → p99 spike at the boundary. Detect: p99-by-minute shows a sawtooth; fix with jittered TTL and single-flight.
  • Out-of-order filter responses → stale paint. Detect: a response token older than current filter state; cancel the obsolete request.
JavaScript
// Cancel the previous query when the filter changes.
let current = null;
function onFilterChange(params) {
  if (current) current.abort();
  current = new AbortController();
  fetch(`/api/tile?${params}`, { signal: current.signal })
    .then(r => r.json())
    .then(render)
    .catch(e => { if (e.name !== 'AbortError') showTileError(e); });
}

What would change the decision: if freshness tolerance drops to seconds, the rollup is out and you push down to a streaming store instead; if concurrency stays under five, skip the cache and keep the base table.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Design resilient dashboard query and rendering behavior.

Answer

Clarify and assume. A dashboard is N tiles, take 12, each backed by one query, with a few derived tiles (a headline that sums or joins others). Read-only, per-user, freshness tolerance around 60s, and no cross-tile transactional consistency needed except for derived tiles. If that last assumption is wrong, a financial-close dashboard where every tile must show the same instant, the design changes, and I'd say so before drawing anything.

Core answer (first 90 seconds). Treat the dashboard as a dependency graph, not a list of tiles. Independent tiles load in parallel, each with its own timeout, one retry, and cancellation. Derived tiles wait for their inputs and are gated: if an input failed, the derived tile renders unavailable, never a number computed from a partial set. Every tile carries a state (loading, fresh, stale, error, partial) plus a fetchedAt timestamp, and the UI shows "as of HH:MM:SS" whenever a tile is stale.

Why cancellation matters. When a user changes a filter, the in-flight queries for the old filter are now wrong. Without cancellation they can resolve after the new ones and overwrite fresh data with stale data: a race, not a cosmetic issue. AbortController fixes it:

JavaScript
// per-tile fetch; checked against Node 20 and current browsers
async function loadTile(tile, outerSignal) {
  const ctrl = new AbortController();
  const onAbort = () => ctrl.abort();
  outerSignal.addEventListener('abort', onAbort, { once: true });
  const t = setTimeout(() => ctrl.abort(), tile.timeoutMs); // 2000
  try {
    const res = await fetch(tile.url, { signal: ctrl.signal });
    if (!res.ok) throw new Error(`HTTP ${res.status}`);
    return { data: await res.json(), fetchedAt: Date.now() };
  } finally {
    clearTimeout(t);
    outerSignal.removeEventListener('abort', onAbort);
  }
}

Trace it: filter change at t=0 aborts tile A, which started at t=-1.8s. A's fetch rejects with AbortError; the caller must branch on that and discard it, not render an error tile. New request B starts. Had A not been aborted, A could resolve at t=+0.3s after B resolved at t=+0.1s, and the tile would show the old filter's numbers under the new filter's label. That is the failure cancellation prevents.

Why correlation enables impact-based alerting. Every request carries a trace ID and a tile ID. Errors group by tile, and tiles are tagged with criticality. Alert on criticality × error rate, not raw error count: 40 errors on a low-value tile is noise; 3 errors on the revenue headline is a page. The trace ID is what joins a tile failure to the backend query that caused it.

Staleness. Each tile stores fetchedAt. Render a stale badge when now - fetchedAt > freshnessBudget (60s here). On a cache outage, tiles keep serving the last good payload with the badge rather than blanking: the user sees old but labelled data, which is honest.

Trade-offs. Independent loading is wrong when tiles must agree on one instant. Then you either issue one query that returns all tiles, or stamp every tile with a shared snapshot version and refuse to render a derived tile whose inputs disagree. The deciding criterion is whether a user can act on a number that is internally inconsistent; if yes, aggregate.

Failure modes. One source down → that tile errors, dependents go unavailable, the rest render. Slow query → per-tile timeout fires at 2s, one retry with 200ms jitter; 12 tiles in parallel cost ~4.2s wall clock worst case, versus 50.4s if serialized: that arithmetic is the argument for parallel loading. Permission error → render a distinct "no access" state, not a generic error, so it isn't retried. Recovery → tiles re-fetch on the next poll and clear the badge.

tile stateshownretried
freshdata + timestampno
stalelast good data + badgeon next poll
errorerror stateonce, then stop
partialavailable inputs only, dependents unavailableno

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-20

Design safe dashboard exports and subscriptions.

Answer

Assumptions. A multi-tenant BI tool (Looker/Metabase/Superset-class) over a warehouse with row-level security; dashboards render per viewer; exports go to PDF and CSV/XLSX; subscriptions deliver by email or Slack; subscribers are employees, some touching regulated data.

The 90-second answer. Reauthorize at generation time as the subscriber, not as the service account that runs the job, and fail closed. Scope the export with the same RLS predicate the live view uses. For confidential data, deliver a short-lived signed link rather than an attachment. Sanitize every tabular cell before it reaches Excel. Watermark, retention and row caps follow from those four.

Why generation time, not view time. The export job runs as a service account. If it reuses the viewer's cached session, or a snapshot rendered when the dashboard was last opened, the data reflects permissions at view time. A user whose warehouse role was revoked yesterday still receives today's rows. Re-evaluate the predicate at run time with the subscriber's identity; if the identity is deactivated or the predicate errors, skip the send and log: never fall back to unfiltered.

Formula injection. Excel and Sheets evaluate a cell whose first character is =, +, -, @, tab, or CR. A value like =HYPERLINK("http://attacker/","open"), or the legacy DDE =cmd|'/c calc'!A0, executes on open. OWASP's CSV Injection guidance is to prefix such cells with a single quote.

Python
# Python 3.12
DANGEROUS = ("=", "+", "-", "@", "\t", "\r")

def csv_cell(v: str) -> str:
    return "'" + v if v and v[0] in DANGEROUS else v

Trace: csv_cell('=HYPERLINK("http://x","a")'). First char = is in DANGEROUS, so it returns '=HYPERLINK("http://x","a"); Excel renders it as text. csv_cell("2024-06-01"): 2 is not dangerous, returned unchanged. The apostrophe is visible in some CSV readers; if that matters, emit XLSX with string-typed cells instead, which sidesteps the class entirely.

Delivery: attachment vs link.

Email attachmentSigned portal link
Revocationnone once sentexpire the URL
Auditwho receivedper-open log
Sizegateway cap (Gmail 25 MB, Exchange default 10 MB)no cap
Offlineyesneeds login

Decide by classification: internal aggregates can attach; anything row-level or PII goes as a 15-minute, single-use URL bound to the subscriber.

Size arithmetic. 100k rows × 12 columns × ~40 bytes ≈ 48 MB: over Gmail's 25 MB cap. Cap inline rows at 50k (~24 MB) and link beyond.

Stale schedules. A subscription outlives the dashboard: the owner leaves, the saved query references a dropped column, the schedule keeps emailing a snapshot. Validate the saved query against the current schema each run, alert after 2 consecutive failures, auto-pause after 5.

Watermark and retention. Embed subscriber email plus generation timestamp in the PDF footer and as a trailing CSV column, so a leaked file is traceable. Object-storage lifecycle: 30 days internal, 7 days confidential.

Failure modes.

  • Permission change mid-flight: user revoked between render and send. The send-time re-check fails, the job logs authz_denied, no email goes out.
  • Shared mailbox: a subscription to a group alias leaks to ex-employees. Audit alias membership; bind to individual identities.
  • Redaction: a column hidden in the view still exported. Compare the exported column set to the view's visible set; a mismatch fails the job.

What would change the decision. If the warehouse can't evaluate RLS per request cheaply, precompute per-role materialized views and export from those, trading freshness for cost. If the data is public, drop the link requirement and attach.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-1

Design a dashboard from an ambiguous stakeholder request.

Answer

First 90 seconds: I treat "we need a dashboard" as a request for a decision surface, not a chart collection. I ask four questions: who is the primary user, what recurring decision do they make, what action follows, and how long do they have? Then I state assumptions and answer directly.

Assume a payments platform. Stakeholder is VP Support. Primary user is payments on-call; secondary is release captain. Recurring decision: page on-call and roll back release. Cadence: 5-minute refresh during incidents, daily otherwise. Time available: 30 seconds. Source of truth: ledger DB, not dashboard cache. Action: page, failover, rollback.

I'd build one operational dashboard with five zones: status, 24h trend, processor comparison, exception table, diagnostic drill-down. I'd defer finance revenue metrics to a separate weekly report because they don't change the on-call action.

Why this shape: status answers "is it broken now?" Trend answers "is it getting worse?" Comparison answers "which component?" Exceptions answer "what changed?" Diagnostic answers "why?" Each zone maps to a decision, not a chart type.

Hypothetical thresholds for this payments example:

QuestionMetricThresholdActionOwnerFreshness
Is checkout broken?payment success rate, 5-min window<99.0% for 2 consecutive windowspage on-callpayments on-call60s
Which processor?error rate by processor>2% or 5x 7-day baselinefailoveron-call60s
Did release cause it?error rate by versionnew version >3x oldrollbackrelease captain5m
Are we losing money?failed payment amount>$5k in 15mnotify financefinance ops15m

I'd prototype in Grafana or Looker against a 7-day replay of real ledger data for 3 days, then run 5 decision tasks with on-call. If they can't answer "page or not?" in 30 seconds, the layout is wrong. A 20-page spec would not surface that. But if the dashboard is regulatory or financial reporting, spec first: definitions and lineage are the deliverable, not the chart.

Self-serve BI lets 50 people build 200 dashboards; curated keeps 5 dashboards with owners. For an incident surface, curated wins because a wrong dashboard during an incident costs more than a missing one. For exploratory product analytics, self-serve wins. Real-time streaming only if the action changes within seconds, e.g., fraud blocking; otherwise 5-minute batch is enough and cheaper.

Failure modes. Stale data: dashboard shows green while ledger is red. Detect by comparing dashboard freshness timestamp to source watermark; alert if lag > 2x refresh interval. Cost: on-call trusts green, misses outage. Ambiguous ownership: no one updates thresholds after a processor change. Detect by empty owner field or last-reviewed >90 days. Cost: alert fires on obsolete baseline. Nobody trusts it: people keep a personal spreadsheet. Detect by usage: <3 unique viewers/week or high bounce. Cost: dashboard abandoned, decisions revert to Slack. Metric drift: success rate definition changes from "authorized" to "captured." Detect by dbt test or metric layer version. Cost: trend line lies.

Worked trace. 14:05, success rate 97.8% for 2 windows. Status red. On-call clicks processor panel: processor B error rate 12% vs 0.4% baseline, 30x. Version panel shows v42 deployed 14:00, error rate 3x v41. Action: failover to A, rollback v42. Time from alert to action: 90 seconds. Without the exception table, on-call queries logs for 10 minutes.

The design changes if the stakeholder actually wants a weekly board report: same questions, but no 5-minute refresh, no paging, and lineage and definitions matter more than drill-down speed.

Curated: · Written: · Reviewed:

Difficulty: Hard