Skip to main content
Formatting controls how values display in queries and visualizations. You set a format on a dimension or measure using the format parameter, or define reusable formats at the model level with custom_formats. Formats can also be set on a per-query basis from visualization configuration, using the same format types.

Common questions

Formats are applied after the SQL runs, so they do not impact grouping. To handle grouping with truncation, use ROUND() or FLOOR().
While both custom_formats and constants enable reusability, they serve different purposes:
  • Use custom_formats when you need to define a complete format object that will be used across multiple fields
  • Use constants when you need a reusable string value that might be used in format strings or other contexts
Yes. 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
Constants are validated against the model: unknown names and malformed @{...} references surface as model validation issues in the IDE.
No. 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.
There are two separate ways Markdown can factor in:The key difference: format returns plain text; markdown returns rendered Markdown HTML in table cells.You can set both on the same field: format controls display in standard value cells (and for numeric/date fields); markdown takes over when the column is shown as Markdown in a table visualization.See Mustache templates, Dimension markdown, and Measure markdown for syntax and examples.

Where to define formats

Formats can be defined in two places: Both approaches support the same format types — the difference is whether the format is defined inline on the field or defined once and referenced by name.

Choosing a format type

Formats accept four shapes. Pick the one that matches your use case:

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

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.

Time formats

Time formats are available for dimensions only.
Time format with timeframe metadata

Excel-style strings

In addition to named formats, formats accept Excel-style strings. These follow the same conventions as spreadsheet number formats.
For standard currency display, prefer named formats like usdcurrency_2 or gbpaccounting_0. Use Excel-style 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.

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.
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

Excel-style 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:
Dynamic currency symbol from another field
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.

Mustache templates

Any format string — named, Excel-style, or a conditional branch — can embed Mustache references to other fields in the row using {{view_name.field_name.property}} syntax. Omni resolves these references at display time before applying the format. What happens with the resolved string depends on the field type:
Dynamic currency symbol for a number (embed in format string)
Dynamic currency symbol as a conditional else branch
Computed display value for a string field
When used on a string or other non-number field, the resolved string is returned as plain text — it is not processed as Markdown HTML. If you need Markdown rendering in table cells (bold text, links, images), use the markdown parameter instead.
Mustache templates in format can be made reusable using custom_formats or constants, the same as any other format string.

Conditional formats

Conditional formats apply 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. See the custom_formats documentation for a complete list of properties.
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

Reusable formats (custom_formats)

Reusable formats are format objects defined in a model file using the custom_formats parameter. They let you centrally manage format definitions and apply them consistently across multiple dimensions and measures. Reusable formats can include any valid format type — named formats, Excel-style strings, Mustache templates, or conditional formats.

Referencing custom formats

Reference a reusable format using either a plain string or explicit object syntax: Plain string (recommended):
Explicit object:
See the custom_formats parameter page for syntax, properties, and examples.

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 Excel-style string in that model respects the locale’s conventions automatically.

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.
  • Excel-style 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:
1
Convert the raw value to a fraction of a day (divide milliseconds by 86400000). This will get the fraction that Excel-style time format codes expect.
2
Apply a format string using either:
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
Adjust the thresholds (3600000 ms = 1 hour, 60000 ms = 1 minute) to control when the display switches between hour-, minute-, and second-scale patterns.