Localizing number formatting

Stay organized with collections Save and categorize content based on your preferences.

Number format localization is often set in conjunction with model localization and user-interface language selection. To learn more about those topics, visit the Localizing your LookML model and Supported user-interface languages documentation pages.

Looker's default number format setting for numbers that appear in data tables and visualizations is 1,234.56. However, the number format can be set to any of the following:

  • 1,234.56: Thousands separated with commas; decimals separated with a period
  • 1.234,56: Thousands separated with periods; decimals separated with a comma
  • 1 234,56: Thousands separated with spaces; decimals separated with a comma

Setting number formats for users

You can set a number format through one of the following methods:

  • To set a number format for individual users: Select the desired format from the Number format drop-down menu on the Edit User page in the Admin panel and click Save at the bottom of the page.

  • To set a number format for a user group: Assign the desired format to the number_format user attribute for a particular user group. If users within the group have set a custom value for number_format, the custom value will override any value assigned to the group. To prevent that from happening, ensure that the User Access setting for the number_format user attribute is not set to Edit.
  • To set a number format for an instance: Assign one of the codes in the above table to the Number format field on the Localization page of the Admin panel.

The default number format in Looker looks like this:

If you change the number format to 1.234,56, it looks like this:

The Number format setting with other methods of number formatting

If you use the LookML parameters value_format_name or value_format to format fields in your models, the number format selected in the Number format setting or number_format user attribute is applied on top of the format given in the LookML parameters. For example:

Similarly, if you use the Value Format field in a visualization's Edit menu, the number format set in the Number format setting or number_format user attribute will be applied on top of the format selected in the Value Format field:

You cannot use LookML parameters or the Value Format field in a visualization's Edit menu to set formatting to 1.234,56 or 1 234,56. To set those formats, you must use the Number format setting or the number_format user attribute. value_format, value_format_name, and the Value Format field use Excel-style formatting strings.

Overriding the Number format setting with strict_value_format

Typically, the number formatting set in the Number format setting or number_format user attribute is applied on top of formats applied by LookML parameters.

However, if you want to create a number format that is not affected by the Number format setting or number_format user attribute, you can use the named_value_format model parameter to create a number format and set its strict_number_format subparameter to yes. That format can then be applied to fields using the value_format_name parameter, and those fields will not be affected by Number format or number_format.

For example, first create a custom format in your model file and set the strict_value_format subparameter to yes:

named_value_format: dollar_formatting {
  value_format: "$#,###.00"
  strict_value_format: yes
}

Then apply that formatting to a field or fields in your view file:

measure: average_sale_price {
  type: average
  value_format_name: dollar_formatting
  sql: ${sale_price} ;;
}

This results in a Look like this: