Semaphor

Metric Comparisons

Show how a metric is doing against a previous period, a previous year, or a target.

What metric comparisons do

A single number rarely tells the whole story. Revenue of $48,000 looks very different depending on whether last month was $40,000 or $60,000. A metric comparison puts the current value next to a baseline, so viewers see the change, not just the number.

You can compare a metric with:

  • the previous period (this month vs. last month),
  • the same period a previous year (this April vs. last April), or
  • a fixed target you set.

Every comparison comes down to three things: which date the metric uses, which date range is active, and what to compare against. Change the active date range and both windows move together; the baseline you picked stays the same.

PartQuestion it answersExample
Date fieldWhich date does this metric track?orders.order_date
Current windowWhich date range is showing?April 1 to April 30
BaselineWhat do we compare it with?Previous period (March)

Who sets comparisons

Authors and viewers each control a different part, and an author's choice always wins.

As an author, you set the baseline on each metric. You can pick a specific baseline, turn comparison off, or leave the metric set to Inherit dashboard comparison so it follows whatever viewers choose. You can also turn off inheritance for an entire visual.

As a viewer, you can pick Off, Previous period, or Previous year from the Global Date control, or from an eligible date filter when the dashboard doesn't use Global Date. Your choice only reaches metrics the author left set to inherit. It never changes a metric the author configured directly.

What the author set on a metricWhat happens
OffThe metric never shows a comparison
Previous period, Previous year, or TargetThe metric uses that baseline
Inherit dashboard comparisonThe metric follows the viewer's dashboard comparison choice

Viewers can explore, not override

A viewer can turn comparisons on across a dashboard without edit access, but cannot replace a metric's set baseline or switch on a metric the author turned off. Comparisons a viewer chooses never rewrite the saved dashboard.

Set a comparison on a metric

  1. Open the visual editor and add a metric to a supported visual.
  2. Make sure the metric has a date to compare over. That can be a date shown on the visual (such as a Trend By field on a KPI), a date you configure for the visual, or the dataset's primary date field.
  3. Select a date range with a clear start and end, from the Global Date control or on the card itself.
  4. Open the metric's settings and, under Comparison Type, choose Previous Period, Previous Year, Target, Off, or Inherit dashboard comparison.
  5. For a period comparison, set how far back to look and how to align the dates (covered in Baseline options below).
  6. Choose the metric's Favorable direction so the color and arrow mean the right thing:
    • Higher is better is the default.
    • Lower is better suits costs, errors, latency, and similar metrics.
    • Neutral shows the direction without calling it good or bad.
  7. Use the visual's Comparison section to change how the result looks.

Some metrics decide their own direction

If a metric's favorable direction is defined in your semantic model, that setting is used and the editor shows it as managed, so a per-visual choice can't quietly disagree with it.

Let viewers compare across the dashboard

The Global Date control lets a viewer apply one comparison across every eligible visual at once, without opening any card.

  1. Open the Global Date control and choose a date range with a start and end.
  2. Under Compare, choose Previous period or Previous year.
  3. If you want, adjust how far back to look, turn To date on or off, or turn on Match weekdays.

The control tells you how many visuals will pick up the selection and how many have their own author-set comparison. Choose Reset to clear your selection and return to the dashboard's saved default, without changing the date range.

Compare from a date filter

A dashboard doesn't need a Global Date control to offer comparisons. A date filter on a specific field, such as an Order Date filter, has the same Compare choices in its footer.

  1. Pick a date range with a clear start and end on the filter.
  2. Under Compare, choose Previous period or Previous year.

The comparison reaches visuals whose comparison date is that exact field from the same dataset. The filter tells you how many visuals pick it up, and each visual's Comparison badge names the filter it inherited from.

Where your selection applies

Whether a visual picks up your comparison depends on what the author configured. Say you've chosen Previous period from Global Date or a date filter:

The metric's settingWhat the visual shows
Inherit dashboard comparisonYour Previous period comparison, with the badge naming where it came from
A baseline the author set, such as Previous year or a TargetThe author's comparison. The badge says it was set by the author
OffNo comparison. Your selection never switches it back on
Inherit, but the author turned off inheritance for the visualNo comparison on that visual. Your selection still reaches other visuals

The control you're using tells you the split up front: how many visuals will pick up your selection and how many have their own author-set comparison.

Which control wins

A metric's own setting always comes first, as the table above shows. When more than one date control could supply the comparison for an inheriting metric, the dashboard picks one owner.

The scenarios below assume a Sales visual whose date field is Order Date.

ScenarioRows the visual showsComparison used
Global Date: June, Compare Previous period. No Order Date filter.JuneJune vs. May, inherited from Global Date
No Global Date. Order Date filter: June, Compare Previous year.JuneJune vs. June last year, inherited from the Order Date filter
Global Date: June, Compare Previous period. Order Date filter: May.Rows in both June and MayJune vs. May, inherited from Global Date. The filter's range keeps filtering, so contradictory ranges can leave no rows
Global Date: June, Compare Off. Order Date filter: May, Compare Previous year.Rows in both June and MayNone. Global Date's Off wins while its range applies
Global Date cleared or All time. Order Date filter: June, Compare Previous period.JuneJune vs. May, inherited from the Order Date filter
Global Date cleared. Two date filters both target Order Date.Rows allowed by both filtersNone while the match is ambiguous
A Ship Date filter is set, in addition to any of the above.Also narrowed by Ship DateUnchanged. A filter on another field never supplies the comparison

Ownership decides which control supplies the comparison windows and baseline, never which filters apply: every date filter keeps filtering rows the whole time. A date filter's saved Compare choice stays put while Global Date governs, and takes over again as soon as Global Date is cleared.

Baseline options

Previous period

Compares the current window with the equal-length window right before it. A full April compares with March; an arbitrary 14-day range compares with the 14 days before it.

To look further back, set Periods back above 1. With a monthly window, 2 compares April with February.

Previous year

Compares the current window with the matching window one or more years earlier. The dates are worked out in the dashboard's timezone, and follow your fiscal calendar if your model defines one.

Set Years back above 1 to compare against an earlier year.

Target

Compares a metric with a fixed number you choose. A target belongs to a specific metric, so authors set it directly and it isn't offered in the viewer's Global Date control. Targets are available on KPI, table, and bullet visuals.

Compare incomplete or weekday-sensitive periods

To date

When the current window isn't finished yet, comparing all of it with a full prior window isn't fair. To date lines up the same elapsed stretch of each.

For example, on July 11:

Current windowWithout To dateWith To date
July 1 to July 11June 1 to June 30June 1 to June 11

Comparisons a viewer starts from Global Date use To date by default. A comparison an author sets keeps whatever the author chose.

Match weekdays

Some patterns depend on the day of the week more than the calendar date. Match weekdays shifts the whole comparison window as one block so weekdays line up, instead of matching the exact dates. The resolved dates in the comparison details are always the source of truth for what was compared.

Choose how comparisons look

The visual's Comparison section controls presentation. Supported built-in visuals share these settings:

SettingOptions
Calculated asDifference, Percent change, Both, or Ratio
Percent/ratio precision0 to 6 decimal places
IndicatorArrow with badge, Arrow, Badge, or None
Sentiment colorOn or off, with your own increase, decrease, and no-change colors
LabelOne label, or separate labels for increase, decrease, and no change

The math behind each mode:

Difference      current − comparison
Percent change  (current − comparison) ÷ | comparison |
Ratio           current ÷ comparison

Percent change divides by the comparison value's size, so the sign of the percentage follows the direction of the change even when the baseline is negative.

When the comparison value is exactly zero, Difference still works, while Percent change and Ratio are shown as unavailable. Semaphor never fills in a zero or an infinite percentage to hide that.

Which date and date range a comparison uses

Most of the time a comparison just works. When it doesn't appear, it's usually because of the date field or the date range, so it helps to know how each is chosen.

The date field

Each visual compares against one date field, picked in this order:

  1. A date shown on the visual, such as an axis or a time grouping.
  2. A date you configure for a single-value or aggregate visual, even if it isn't shown.
  3. The dataset's primary date field.

If none of these points to one clear field, or a visual pulls dates from several datasets and the choice is ambiguous, the visual can't compare until you pick a date. Semaphor won't guess by grabbing the first date it finds.

Time-series charts need a date on the axis, because the earlier values are drawn onto the current dates. KPIs, category charts, and table metrics can compare using a configured or primary date without showing it.

The date range

Period comparisons need a range with both a start and an end.

When the Global Date range and a card's own date range point at the same field:

  • The Global Date range is what the comparison uses.
  • The card's range stays saved, and takes over again when Global Date is cleared or doesn't apply.
  • Date filters on other fields keep working as ordinary filters.

The comparison window always comes from one control; two ranges are never blended into a single window, because a blended window could show a comparison that doesn't match what's on screen.

A date filter you add to the dashboard can also supply the window. When Global Date has no range with a start and end, a date filter that matches the visual's date field exactly, same field from the same dataset, takes over the comparison with its own range and Compare choice. See Which control wins for the full precedence.

A few date settings can't define a comparison window: a single-sided condition (after a date, before a date), an exact-date match, not between, All time, or a reversed range. The visual still shows its current value; the comparison simply waits until there's a range with a start and end.

Where comparisons are available

Support depends on how a visual presents its numbers as much as on the visual type.

VisualPeriod comparisonTargetWhat it shows
KPIYesYesCurrent value, previous or target value, and a change indicator
Bar and horizontal barYesNoCurrent and comparison bars
Stacked barYesNoCurrent and comparison series
Line, area, stacked area, combo, stacked lineYesNoAn earlier series drawn on the current dates
TableYesYesThe comparison value and your chosen presentation
Pivot tableYesNoComparison columns for each pivoted metric
BulletYesYesCurrent value with a period or target marker
Custom visualComparison data is providedN/AYour renderer decides how to show it

Pie, donut, polar, radar, scatter, bubble, funnel, tornado, range, treemap, heatmap, text, and map visuals don't offer comparison settings yet.

Raw SQL cards don't get built-in comparisons. Columns you name current, previous, or delta in your own SQL are treated as ordinary results.

When a comparison can't run

When a comparison can't be worked out, the card keeps showing its current value and explains why rather than showing a wrong or empty number. The usual reasons:

  • No date range with a start and end is selected.
  • No single date field can be resolved for the visual.
  • Several possible date fields are ambiguous.
  • Two dashboard date filters match the same date field, so neither can own the comparison.
  • There isn't enough history to fill the comparison window.
  • The visual type or a raw SQL card doesn't support comparisons.

Missing history stays missing; it's never turned into zero. In a grouped result, a category can still appear for the current window even when it has no match in the comparison window.

To see exactly what a live comparison used, open the Comparison badge on the card. It shows the baseline, where it came from (set by the author, inherited from Global Date, or inherited from a named date filter), and the resolved current and comparison date ranges.

Comparisons in saved views, embeds, and exports

A dashboard's date range and comparison selection are saved as two separate parts of the same setting. Lenses, embed inputs, scheduled snapshots, exports, PDFs, and Briefing attachments all preserve the comparison that was in effect for that run, so a saved or shared view shows the same numbers later.

Choosing a comparison as a viewer never changes the visual's saved configuration.

On this page