Skip to main content
The format parameter sets the default display format for a measure’s values. Measures can use one of Omni’s named formats, an Excel-style custom format string, or a conditional format that selects a format dynamically. Formats can also be set on a per-query basis from visualization configuration, using the same format types.
Formats are applied after the SQL runs, so they do not impact grouping. To handle grouping with truncation, use ROUND() or FLOOR().

Syntax

format accepts either a string or a conditional object:
<measure_name>:
  format: <format_name>

Choosing a format type

format accepts three shapes. Pick the one that matches your use case:
Use thisWhen you want toExamples
Named formatApply a built-in format. Start here — named formats handle currency, percentages, and compact numbers. Use a currency prefix like usd, gbp, or jpy for a specific currency; omit the prefix to use the locale’s default.currency_2, usdaccounting_0, percent_1, big_2
Custom format stringControl layout beyond what named formats offer — append units, add text, use semicolon sections for positive/negative display, or interpolate other fields with Mustache.'#,##0.00 "kg"', '"🚀 "0.0;"📉 "-0.0'
Conditional formatChoose the format at runtime based on a field value, user attribute, or filter. Each branch can reference a named format, a custom string, or a model constant.depends_on: { field: currency_code }

Named formats

Numeric and currency formats default to two decimal places, with the exception of id. You can explicitly set decimal places by appending _<number_of_places> (up to 4) to a numeric or currency format. For example, format: number_4, format: big_1, format: usdaccounting_0. When decimal length isn’t set, decimals will be truncated to the shortest possible length for each row.

Numeric formats

FormatExampleNotes
number1,234.50 (number_2)
percent24.4% (percent_1)
id123450Numbers, no commas
billions1.20B (billions_2)
millions5.6M (millions_1)
thousands8.90K (thousands_2)
big5.60M; 1.23K; 12.23 (big_2)Uses millions if >1M; thousands if >1000; otherwise number

Currency formats

Currency formats are available for USD, EUR, GBP, AUD, JPY, and BRL. Prefix the format category with the currency code (for example, usdcurrency, jpyaccounting). Formats without a currency prefix use the organization’s default currency.
Format categoryExampleNotes
accounting (e.g. usdaccounting, jpyaccounting)$(1,234.50) (usdaccounting_2)
currency (e.g. usdcurrency, gbpcurrency)-£1,234.50 (gbpcurrency_2)
bigcurrency (e.g. bigusdcurrency, bigjpycurrency)€5.60M; €1.23K; €12.23 (biggbpcurrency_2)Compact display
financial (e.g. audfinancial, brlfinancial)(1,234.50) (financial_2)Does not contain a currency mark
bigaccounting, bigfinancial (e.g. bigusdaccounting, bigjpyfinancial)Same compact rules as big* formats

Custom format strings

In addition to named formats, format accepts Excel-style custom format strings. These follow the same conventions as spreadsheet number formats.
For standard currency display, prefer named formats like usdcurrency_2 or gbpaccounting_0. Use custom format strings when you need layout control that named formats don’t offer — for example, appending units, mixing text with numbers, or using semicolon sections for positive/negative display.
PatternDescriptionExample output
#,##0Number with thousands separator, no decimals1,234
#,##0.00Number with thousands separator, 2 decimals1,234.56
0%Percentage, no decimals75%
0.00%Percentage, 2 decimals75.00%
0.00E+00Scientific notation1.23E+03
#,##0 "units"Number with literal text suffix1,234 units
#,##0.0,Divide by 1,000 (trailing comma)1.2
#,##0.0,,"M"Divide by 1,000,000 with suffix1.2M

Semicolon-separated sections

Excel-style format strings support up to four sections separated by semicolons, applied in order: positive values; negative values; zero; text. You can omit trailing sections — for example, two sections apply the first to positive values and the second to negative values.
format: '"🚀 "0.0;"📉 "-0.0;0'
This renders:
  • Positive values as 🚀 1.5
  • Negative values as 📉 -1.5
  • Zero as 0
Use quoted YAML strings so " and ; parse correctly.

Mustache field references

Custom format strings can include Mustache references to other field values using {{view_name.field_name.property}}. This lets you build format strings that incorporate values from other fields in the query, such as a dynamic currency symbol. Supported properties:
PropertyDescription
valueThe formatted field value
rawThe unformatted field value
value_url_encodedThe URL-encoded formatted value
Dynamic currency symbol from another field
revenue:
  sql: '"amount"'
  aggregate_type: sum
  format: '#,##0.00 "{{orders.currency_symbol.value}}"'
Referencing other fields in a format string implicitly requires those fields to be included in the query results. Omni will automatically add them, which may change the GROUP BY clause of the generated SQL.

Conditional format

Conditional format applies different format strings depending on a runtime value — for example, formatting a revenue measure with the right currency symbol based on a currency_code dimension, or showing different decimal precision based on a user attribute. Define a depends_on source and an ordered list of conditions using Omni filter syntax. The first matching condition determines the format. If no condition matches, the else format is used.
format
object

Resolution timing

The depends_on source determines when and how the format is resolved:
SourceResolution timingBehavior
fieldAt display time (per row)Evaluated against each row’s value after query results are returned. Each row can resolve to a different format.
user_attributeAt query preparation timeThe user attribute value is evaluated once. The entire field uses the single resolved format.
filterAt query preparation timeThe filter value is evaluated once. The entire field uses the single resolved format.

Examples

Currency format
sale_price:
  format: currency_2
Big number format
revenue:
  format: big_2
Custom Excel-style format with units
avg_weight:
  sql: '"weight"'
  aggregate_type: avg
  format: '#,##0.00 "kg"'
Conditional format based on a field value
dimensions:
  currency_code:
    sql: '"currency_code"'
measures:
  revenue:
    sql: '"amount"'
    aggregate_type: sum
    format:
      depends_on:
        field: currency_code
        conditions:
          - condition:
              is: "USD"
            value: usdcurrency_0
          - condition:
              is: "GBP"
            value: gbpcurrency_0
        else: currency_0
Conditional format with numeric conditions
dimensions:
  age:
    sql: '"age"'
measures:
  total:
    sql: '"amount"'
    aggregate_type: sum
    format:
      depends_on:
        field: age
        conditions:
          - condition:
              greater_than: "18"
            value: "#,##0.00"
          - condition:
              between:
                - 10
                - 18
            value: "#,##0"
        else: "0"
Conditional format based on a user attribute
revenue:
  sql: '"amount"'
  aggregate_type: sum
  format:
    depends_on:
      user_attribute: preferred_currency
      conditions:
        - condition:
            is: "USD"
          value: usdcurrency_2
        - condition:
            is: "EUR"
          value: eurcurrency_2
      else: currency_2
Conditional format based on a filter value
revenue:
  sql: '"amount"'
  aggregate_type: sum
  format:
    depends_on:
      filter: currency_filter
      conditions:
        - condition:
            is: "USD"
          value: usdcurrency_2
        - condition:
            is: "GBP"
          value: gbpcurrency_2
      else: currency_2
Branch formats referencing model constants
constants:
  high_precision:
    value: "#,##0.0000"
  low_precision:
    value: "#,##0.0"

measures:
  measurement:
    sql: '"value"'
    aggregate_type: avg
    format:
      depends_on:
        field: unit_type
        conditions:
          - condition:
              is: "scientific"
            value: "@{high_precision}"
          - condition:
              is: "summary"
            value: "@{low_precision}"
      else: "@{low_precision}"
Reporting currency filter driving named formats
filters:
  reporting_currency:
    type: string
    suggestion_list:
      - value: converted_EUR
        label: Converted to EUR
      - value: converted_USD
        label: Converted to USD

measures:
  revenue_display:
    sql: '"amount"'
    aggregate_type: sum
    format:
      depends_on:
        filter: reporting_currency
        conditions:
          - condition:
              is: converted_EUR
            value: eurcurrency
          - condition:
              is: converted_USD
            value: usdcurrency
      else: usdcurrency

Model constants in format strings

You can reuse a model constant inside any format string — named, custom Excel-style, or a conditional format branch — with @{constant_name}:
Model file
constants:
  compact_time:
    value: 'm:ss "min"'
  margin_display:
    value: '#,##0.00 "bps"'
Dimension or measure
dimensions:
  margin:
    sql: '"margin_bps"'
    format: "@{margin_display}"
Constants are most useful for custom Excel-style patterns that appear in several fields, or that you want to maintain in one place. If a named format like usdcurrency_2 or percent_1 already does what you need, use it directly — there is no benefit to wrapping a named format in a constant.
Constants are validated against the model: unknown names and malformed @{...} references surface as model validation issues in the IDE.

Locale and number formatting

The default_numeric_locale model parameter controls how all formatted numbers are displayed — including the thousands delimiter, decimal delimiter, and default currency symbol. When you set a locale, every named format and custom format string in that model respects the locale’s conventions automatically.
LocaleThousandsDecimalDefault currencycurrency_2 renders as
en_US (default),.$$1,234.50
en_GB,.££1,234.50
fr_FR (space),€1 234,50
de_DE.,€1.234,50
ja_JP,.¥¥1,234.50
br_BR.,R$R$1.234,50
nl_NL.,€1.234,50

Setting the locale

Set default_numeric_locale in any model file:
Model file
default_numeric_locale: fr_FR

Dynamic locale per user

Use a user attribute so each user sees numbers formatted for their region:
Model file
default_numeric_locale: {{ omni_attributes.user_locale }}
This resolves at query time. A user whose user_locale attribute is de_DE sees 1.234,50 €, while a user with en_US sees $1,234.50 — from the same query and the same format strings.

Locale interaction with format types

  • Named formats (currency_2, accounting_0, etc.) — the locale’s default currency symbol is used when no currency prefix is specified. Prefixed formats like usdcurrency_2 override the locale’s default symbol.
  • Custom format strings (#,##0.00) — the #, ,, . tokens are locale-aware. A format of #,##0.00 renders 1.234,50 under de_DE.
  • Currency-prefixed named formats (gbpcurrency_2, jpyaccounting_0) — always use the specified currency symbol, regardless of locale. The delimiter and decimal conventions still come from the locale.

Durations and wallclock-style times

Timestamp dimensions should use strftime-style strings (they must include % in the format). See Time formats. For numeric durations stored as milliseconds (or seconds) that you want to display as hours, minutes, or seconds, you need to convert the value to a fraction of a day before applying a time format string. Omni uses the same convention as spreadsheets: one day = 86400000 milliseconds. Divide your millisecond value by 86400000 to get the fraction that Excel-style time format codes expect. Then use either:
  • A custom format string (possibly through a model constant), or
  • A conditional format that picks a shorter or longer pattern based on how large the duration is (for example, show h:mm:ss when duration is at least 1 hour, otherwise m:ss).
h displays clock hours (wraps at 24). If your durations can exceed 24 hours, use [h] for elapsed hours — for example, [h]:mm:ss renders 25 hours as 25:00:00 instead of 1:00:00. The same applies to [m] for elapsed minutes.
Duration dimension: scale ms to Excel day fraction
dimensions:
  total_duration_ms:
    sql: '"total_duration_ms"'

  duration_as_excel_day:
    sql: ${total_duration_ms} / 86400000.0
    label: Total duration
    format:
      depends_on:
        field: total_duration_ms
        conditions:
          - condition:
              greater_than_or_equal_to: 3600000
            value: 'h "hr" mm "min" ss.0 "sec"'
          - condition:
              greater_than_or_equal_to: 60000
            value: 'm "min" ss.00 "sec"'
      else: 'ss.000 "sec"'
Adjust the thresholds (3600000 ms = 1 hour, 60000 ms = 1 minute) to control when the display switches between hour-, minute-, and second-scale patterns.

Rich text in data tables

The markdown parameter is separate from format:
ParameterUse it for
formatNumeric, currency, percentage, and date/time display formatting after SQL runs.
markdownA Mustache template whose output is rendered as Markdown in data table cells (for example, bold labels, links, badges).
You can set both on the same field: format affects how measures and numbers appear in standard value cells; markdown applies when the column is shown as Markdown in a table visualization. See Dimension markdown and Measure markdown for syntax and examples.