Custom formatting gives you greater control over how numeric data appears in a Looker result set. With custom formatting, you can apply Excel-style formatting options to numeric data shown in visualizations, or produced by custom fields or table calculations.
Using Custom Formatting in Visualizations
To use custom formatting with numeric data in a visualization:
- Click on the visualization’s gear menu.
- Select the Values tab.
- In the Value Format field, enter the custom formatting string.
Using Custom Formatting with Table Calculations and Custom Fields
When creating or editing a table calculation or custom field, select Custom in the formatting drop-down and enter the custom format in the field below:
Custom Formatting Examples
You can read Excel’s complete guide about how to specify these formats in their documentation. However, at this time date formatting, color formatting, and hexadecimal conversion are not supported in Looker.
Some of the most common formatting options are shown below. A format code using
0 requires that non-significant zeros be displayed if the number contains fewer digits than specified in the code. A format code using
# only displays significant digits, even if there are fewer digits than specified in the code.
Some special characters, such as international currency symbols, must be treated as strings and enclosed in double quotes.
|Integer zero-padded to 3 places (001)|
|Integer followed by a string (123 String)("String" can be replaced with any text string)|
|Number up to 2 decimals (1. or 1.2 or 1.23)|
|Number with exactly 2 decimals (1.23)|
|Number zero-padded to 3 places and exactly 2 decimals (001.23)|
|Number with comma between thousands (1,234)|
|Number with comma between thousands and 2 decimals (1,234.00)|
|Number in millions with 3 decimals (1.234 M)Division by 1 million happens automatically|
|Number in thousands with 3 decimals (1.234 K)Division by 1 thousand happens automatically|
|Dollars with 0 decimals ($123)|
|Dollars with 2 decimals ($123.00)|
|Euros with 0 decimals (€123)|
|Dollars with comma between thousands and 2 decimals ($1,234.00)|
|Dollars with 2 decimals, positive values displayed normally, negative values wrapped in parenthesis|
|Display as percent with 0 decimals (1 becomes 1%)|
|Display as percent with 2 decimals (1 becomes 1.00%)|
|Convert to percent with 0 decimals (.01 becomes 1%)|
|Convert to percent with 2 decimals (.01 becomes 1.00%)|