Example

{% measure value="sum(total_sales)" fmt="usd1m" /%}

Date Range Filtering

{% measure
    value="sum(total_sales)"
    date_range={
      range="last 12 months"
      date="date"
    }
    fmt="usd1m"
  /%}
  {% measure
    value="sum(total_sales)"
    date_range={
      range="last 6 months"
      date="date"
    }
    fmt="usd1m"
  /%}

Prior Year Comparison

{% measure
    value="sum(total_sales)"
    date_range={
      range="last 12 months"
      date="date"
    }
    comparison={
      compare_vs="prior year"
    }
  /%}

Calculated Measures

{% measure
    value="sum(total_sales) / sum(transactions) as avg_price" 
    fmt="usd2"
  /%}

Viz: Color Scale

{% measure
    value="sum(total_sales)"
    fmt="usd1m"
    viz="color"
  /%}

Viz: Color Scale with Custom Colors

{% measure
    value="sum(total_sales)"
    fmt="usd1m"
    viz="color"
    color_options={
      color_scale=["#c0392b","#f4f4f4","#27ae60"]
    }
  /%}

Viz: Bar

{% measure
    value="sum(total_sales)"
    fmt="usd1m"
    viz="bar"
  /%}

Viz: Bar with Custom Colors

{% measure
    value="sum(total_sales)"
    fmt="usd1m"
    viz="bar"
    bar_options={
      bar_color="#2c7d00"
    }
  /%}
  {% measure
    value="sum(transactions)"
    viz="bar"
    bar_options={
      bar_color="#339e9c"
    }
  /%}

Viz: Delta

{% measure
    value="sum(total_sales)"
    date_range={
      range="last 12 months"
      date="date"
    }
    comparison={
      compare_vs="prior year"
    }
    viz="delta"
  /%}

Viz: Sparkline

{% measure
    value="sum(total_sales)"
    fmt="usd1m"
    viz="sparkline"
    sparkline_options={
      x="date"
      type="area"
    }
  /%}

Column Info

{% measure
    value="sum(total_sales)"
    fmt="usd1m"
    info="Includes all product sales"
  /%}

Sorting

{% measure
    value="sum(total_sales)"
    fmt="usd1m"
    viz="color"
    sort="asc"
  /%}

Attributes

value
String
required
fmt
String
Format for values. Can be a built-in format or a custom Excel-style format code.
fmt_column
String
Column of format codes used to format values. The format code is pulled from this column for each row in the table.
viz
String
Visualization to show for this measure, including sparklines, bars, colors, and deltas.
delta_options
Delta visualization configuration. When present, enables delta visualization.Example:
delta_options={
  down_is_good = true
  show_symbol = true
  symbol_position = value
  neutral_range = []
}
Attributes:
  • down_is_good: boolean - Whether a downward trend is considered positive
  • show_symbol: boolean - Whether to show the delta symbol
  • symbol_position: enum - Position of the delta symbol relative to the value
  • neutral_range: array
sparkline_options
Sparkline visualization configuration. When present, enables sparkline visualization.Example:
sparkline_options={
  type = value
  x = "string"
  color = "string"
  fit_to_data = true
  date_grain = value
  date_range = { ... }
}
Attributes:
  • type: enum
  • x: string - X-axis column (time/category column for sparkline) - required when viz type is sparkline
  • color: string - Color for the sparkline
  • fit_to_data: boolean - Whether to scale the y-axis to the data range
  • date_grain: enum - Date granularity for sparkline time series
  • date_range: object
bar_options
Bar visualization configuration. When present, enables bar visualization.Example:
bar_options={
  bar_color = "string"
  bar_color_negative = "string"
  hide_labels = true
  fit_to_data = true
}
Attributes:
  • bar_color: string - Custom color for positive values. If not specified, uses default blue.
  • bar_color_negative: string - Custom color for negative values. If not specified, uses bar_color if set, otherwise default red.
  • hide_labels: boolean - When true, hides the text values and shows only the bar visualization.
  • fit_to_data: boolean - When true, scales bars to the data range instead of including zero. This makes bars use the full available width when all values are far from zero.
color_options
Color scale visualization configuration. When present, enables color visualization.Example:
color_options={
  color_scale = []
  scale_column = "string"
  scale_mode = value
}
Attributes:
  • color_scale: array - Custom color scale for type=“color”. Must be an array of colors (e.g., [“#ff0000”, “#00ff00”, “#0000ff”]).
  • scale_column: string - Column to use for color scale calculations when type=“color”. If not specified, the measure column itself is used for scaling.
  • scale_mode: enum - How to calculate min/max for color and bar visualizations. “individual” calculates range per column (default), “shared” calculates range across all related columns.
viz_include_subtotals
Boolean
default:"false"
Whether to apply visualizations (like color and bar charts) to subtotal rows. When false, subtotal rows will not have visualizations applied.
red_negatives
Boolean
default:"false"
When true, negative values will be displayed in red (rgb(220 38 38))
title
String
align
String
info
String
hide
Boolean
default:"false"
Whether to hide this column from the table display. Hidden columns are still included in queries and can be referenced by other columns.
sort
String
Sort direction for this measure column. When specified, the table will be sorted by this column.
comparison
Comparison configuration objectExample:
comparison={
  compare_vs = value
  display_type = value
  target = "string"
}
Attributes:
  • compare_vs: enum - 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)
  • display_type: enum - What to display for comparison. Options: compared_value (comparison period value), abs (absolute change), pct (percentage change)
  • target: string - Target value for target comparison. Can be a column name, aggregation (e.g., “sum(target_sales)”), or literal value.
hide_column_totals
Boolean
Whether to hide this measure in column total/subtotal calculations. When undefined, auto-detection determines if totals should be hidden based on temporal comparison context.
hide_row_totals
Boolean
Whether to hide this measure in row total/subtotal calculations. When undefined, auto-detection determines if totals should be hidden based on temporal comparison context.
date_range
Use date_range to filter data for specific time periods like last 12 months, year-to-date, etcExample:
date_range={
  range = value
  date = "string"
}
Attributes:
  • range: enum
  • date: string

Allowed Parents