format parameter sets the default display format for a dimension’s values. Numeric, currency, and date dimensions 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.
Grouping is not impacted when
format is used, as formatting is applied after SQL runs. To handle grouping with truncation, use ROUND() or FLOOR().Syntax
format accepts either a string or a conditional object:
- String
- Conditional
Choosing a format type
format accepts three shapes. Pick the one that matches your use case:
| Use this | When you want to | Examples |
|---|---|---|
| Named format | Apply a built-in format. Start here — named formats handle currency, percentages, compact numbers, and d3 time formats. 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 string | Control 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 format | Choose 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 ofid. You can explicitly set decimal places by appending _<number_of_places> 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
| Format | Example | Notes |
|---|---|---|
number | 1,234.50 (number_2) | |
percent | 24.4% (percent_1) | |
id | 123450 | Numbers, no commas |
billions | 1.20B (billions_2) | |
millions | 5.6M (millions_1) | |
thousands | 8.90K (thousands_2) | |
big | 5.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 category | Example | Notes |
|---|---|---|
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 |
Time formats
| Format | Notes |
|---|---|
| d3 time formats | Individual timeframe elements can be formatted using timeframe_metadata. Refer to the Examples. |
"%Y-%m" | |
"%Y-%m-%d" | |
"%Y-%m-%d %H:%M:%S" |
Custom format strings
In addition to named formats,format accepts Excel-style custom format strings. These follow the same conventions as spreadsheet number formats.
| Pattern | Description | Example output |
|---|---|---|
#,##0 | Number with thousands separator, no decimals | 1,234 |
#,##0.00 | Number with thousands separator, 2 decimals | 1,234.56 |
0% | Percentage, no decimals | 75% |
0.00% | Percentage, 2 decimals | 75.00% |
0.00E+00 | Scientific notation | 1.23E+03 |
#,##0 "units" | Number with literal text suffix | 1,234 units |
#,##0.0, | Divide by 1,000 (trailing comma) | 1.2 |
#,##0.0,,"M" | Divide by 1,000,000 with suffix | 1.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.- Positive values as
🚀 1.5 - Negative values as
📉 -1.5 - Zero as
0
" 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:
| Property | Description |
|---|---|
value | The formatted field value |
raw | The unformatted field value |
value_url_encoded | The URL-encoded formatted value |
Dynamic currency symbol from another field
Conditional format
Conditional format applies different format strings depending on a runtime value — for example, formatting arevenue 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.
Resolution timing
Thedepends_on source determines when and how the format is resolved:
| Source | Resolution timing | Behavior |
|---|---|---|
field | At display time (per row) | Evaluated against each row’s value after query results are returned. Each row can resolve to a different format. |
user_attribute | At query preparation time | The user attribute value is evaluated once. The entire field uses the single resolved format. |
filter | At query preparation time | The filter value is evaluated once. The entire field uses the single resolved format. |
Examples
Currency format
Big number format
Time format with timeframe metadata
Custom Excel-style format with units
Conditional format based on a field value
Conditional format with numeric conditions
Conditional format based on a user attribute
Conditional format based on a filter value
Branch formats referencing model constants
Reporting currency filter driving named formats
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
Dimension or measure
@{...} references surface as model validation issues in the IDE.
Locale and number formatting
Thedefault_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.
| Locale | Thousands | Decimal | Default currency | currency_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
Setdefault_numeric_locale in any model file:
Model file
Dynamic locale per user
Use a user attribute so each user sees numbers formatted for their region:Model file
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 likeusdcurrency_2override the locale’s default symbol. - Custom format strings (
#,##0.00) — the#,,,.tokens are locale-aware. A format of#,##0.00renders1.234,50underde_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:sswhen duration is at least 1 hour, otherwisem:ss).
Duration dimension: scale ms to Excel day fraction
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
Themarkdown parameter is separate from format:
| Parameter | Use it for |
|---|---|
format | Numeric, currency, percentage, and date/time display formatting after SQL runs. |
markdown | A Mustache template whose output is rendered as Markdown in data table cells (for example, bold labels, links, badges). |
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.