Skip to main content

Field formatting

Passing the value_format_name parameter to your field lets you easily format values in a way that's easy to read for business users.


Options#

There are several options. Broadly speaking, there is a format type followed by a number of decimal places. For example, decimal_1 formats the number like a decimal and rounds to one decimal place.

Value Format NameUnformatted ValueFormatted Value
decimal12345.67812346
decimal_012345.67812,346
decimal_112345.67812,345.7
decimal_212345.6781212,345.68
decimal_312345.6781212,345.678
decimal_412345.6781212,345.6781
decimal_pct_03.4563%
decimal_pct_13.4563.5%
decimal_pct_23.4563.46%
decimal_pct_33.45613.456%
decimal_pct_43.45613.4561%
percent_00.345635%
percent_10.345634.6%
percent_20.345634.56%
percent_30.34561234.561%
percent_40.34561234.5612%
eur12345.678€12.3k
eur_012345.678€12,346
eur_112345.678€12,345.7
eur_212345.678€12,345.68
usd12345.678$12.3k
usd_012345.678$12,346
usd_112345.678$12,345.7
usd_212345.678$12,345.68
image_from_urlhttps://mydomain.com/myimage(Rendered Image)

Examples#

Here's an examples of a field with value_format_name as a property.

- name: avg_price  field_type: measure  type: average  sql: ${price}  value_format_name: usd