User Guide Getting Started Help Center Documentation Community Training
New LookML
Old LookML
New LookML
Looker
  
English
Français
Deutsch
日本語
value_format_name

Usage

view: view_name {
  dimension: field_name {
    value_format_name: format_name
  }
}

Hierarchy

value_format_name

Possible Field Types

Dimension, Measure

Accepts

One of the default value formats listed below, or the name of a format you created with the named_value_format parameter

Definition

The value_format_name parameter enables you to format Looker cells using built-in or custom format names. If you want to format Looker cells using Excel-style formats, use value_format instead.

The value_format_name parameter can be used on both dimensions and measures. For example:

measure: total_order_amount { type: sum sql: ${order_amount} ;; value_format_name: usd }

Default Format Names

Looker formats numeric field types as shown:

Name Example
decimal_0 1,234
decimal_1 1,234.5
decimal_2 1,234.56
decimal_3 1,234.567
decimal_4 1,234.5678
usd_0 $1,234
usd $1,234.56
gbp_0 £1,234
gbp £1,234.56
eur_0 €1,234
eur €1,234.56
id 1234

For numeric field types, id should only be used on numbers that have 16 digits or fewer. Beyond 16 digits, id may round results. For numbers with more than 16 digits, cast them as a string and use id on the string field type.

Default Format Names for Percentages

For percentage formats, Looker takes the underlying decimal value and multiplies it by 100 to get a percentage. The examples below start with the underlying value “0.123456”:

Name Example
percent_0 12%
percent_1 12.3%
percent_2 12.34%
percent_3 12.345%
percent_4 12.3456%

Note that when using one of the default format names, Looker rounds up or down to remove digits, rather than truncating values.

You can also create your own named formats by using the named_value_format parameter.

Top