
Examples
Basic Usage

Attributes
Table or view to query
SQL expression to insert into the SELECT part of the query (e.g., “COUNT(*)”, “SUM(sales)”)
CSS class to apply to the value
Format code for the value (e.g., “num”, “usd”, “pct”). See formatValue documentation for available formats. See Value Formatting for available formats.
CSS color to apply to the value (e.g., “red”, “#ff0000”, “rgb(255,0,0)”)
When true, negative values will be displayed in red (rgb(220 38 38))
Information tooltip text (can only be used with title)
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)
Comparison configuration objectExample:Attributes:
- compare_vs:
string- Type of comparison to perform. Options: prior year (same period last year), prior period (previous period of same duration), target (compare against a target value), benchmark (compare against group average/aggregate)- Allowed values:
prior yearprior periodtargetbenchmark
- Allowed values:
- display_type:
string- What to display for comparison. Options: compared_value (comparison period value), abs (absolute change), pct (percentage change). Default: pct- Allowed values:
compared_valueabspct
- Allowed values:
- target:
string- Target value for target comparison. Can be a column name, aggregation (e.g., “sum(target_sales)”), or literal value. - benchmark:
options group - hide_pct:
boolean- Hide the percentage change line in comparison tooltips - pct_fmt:
string- Format code for percentage values in comparison tooltips - abs_fmt:
string- Format code for absolute values in comparison tooltips
IDs of filters to apply to the query
Custom SQL WHERE condition to apply to the query. For date filters, use date_range instead.
Custom SQL HAVING condition to apply to the query after GROUP BY
Maximum number of rows to return from the query. Note: When used with tables, limit will disable subtotals to prevent incomplete subtotal rows.
Column name(s) with optional direction (e.g. “column_name”, “column_name desc”)
Custom SQL QUALIFY condition to filter windowed results
Use date_range to filter data for specific time periods. Accepts predefined ranges (e.g., “last 12 months”), dynamic ranges (e.g., “Last 90 days”), custom date ranges (e.g., “2020-01-01 to 2023-03-01”), or partial ranges (e.g., “from 2020-01-01”, “until 2023-03-01”)Example:Attributes:
- range:
string- Time period to filter. Use presets like ‘last 7 days’, dynamic patterns like ‘Last 90 days’, custom ranges like ‘2020-01-01 to 2023-03-01’, or partial ranges like ‘from 2020-01-01’.- Allowed values:
last 7 dayslast 30 dayslast 3 monthslast 6 monthslast 12 monthsweek to datemonth to datequarter to dateyear to dateprevious weekprevious monthprevious quarterprevious yearall time
- Allowed values:
- date:
string- Date column to filter on. Required when the data has multiple date columns.
Set the width of this component (in percent) relative to the page width

