
Examples
Using comparison

Attributes
The id of the comparison selector to be used in SQL query templates
Optional array of preset comparison values to show. If not provided, all comparison options will be available.
Default comparison to select on loadAllowed values:
prior yearprior periodtargetbenchmark
Text displayed above the selector
Information tooltip text
URL to link the info text to (can only be used with info)
Create a custom link title for the info link, placed after the info text (can only be used with info_link)
Placeholder text displayed when no value is selected
Icon to display
Set the width of this component (in percent) relative to the page width
Using the Filter Variable
Reference this filter using{{filter_id}}. The value returned depends on where you use it.
| Context | Default Property | No Selection | Result |
|---|---|---|---|
| Inline SQL query | .comparison | {"compare_vs": "prior year"} | |
where attribute | .comparison | {"compare_vs": "prior year"} | |
| Text / Markdown | .comparison | {"compare_vs": "prior year"} |
Available Properties
You can also access specific properties using{{filter_id.property}}:
.selected
Returns the selected comparison value with quotes. Returns an empty string when no value is selected.'prior year'
.literal
Returns the raw unescaped selected value.prior year
.compare_vs
Returns the comparison type. Example value:prior year
.comparison
Returns the full comparison configuration as JSON. Use{{comp}} directly with compare_vs to dynamically configure comparisons.
{"compare_vs": "prior year"}
.agg
For benchmark comparisons: returns the aggregation function. Example value:avg
.subject
For benchmark comparisons: returns the subject column that defines entities. Example value:region
.target
For target comparisons: returns the target value or expression. Example value:100000

