Format Metrics in Flex Insights Reports
Use the Number format editor to configure how numbers appear in your reports. You can round numbers, accommodate regional settings, add currency symbols, adjust colors, or append numbers with sets of characters.
Access the number format editor
To access the Number format editor, click Edit in the Detail column of a metric.
Then apply formatting syntax in the custom number formats field.
You can use built-in templates for number formatting, or any of the examples below by copy-pasting this sample code directly into your number format editor:
Raw integer number:
Natural integer with thousand separators such as
One decimal number with thousand separators (
Two decimal number with thousand separators (
This shortens large numbers and makes them easier to read – for example,
145.4K . Numbers below one thousand are shown as exact integers.
General purpose large number:
Duration format will take a number (in seconds) and show it in hours, minutes and seconds.
Duration in hours will look like
1h 23:45 or
12:34 when shorter than one hour.
Percentages convert numbers in the range
1.0 into the more natural percentage format
100% . Use the below samples for the format you need.
One decimal percentages:
Two decimals percentages:
You can use web colors to change the text and background color in your Flex Insights tables. You can use HTML color codes to adjust your colors.
You may wish to use the same color with the same measure to help your users quickly orient in a table. You can also combine colors with conditional formatting to change color depending on the value of a measure.
The example below shows how to set the same color for the measure text, in any situation:
The example below shows how to change the background cell color of a measure.
You can show different number formats depending on the value of the measure. This allows you to easily show positive/negative number differently or handle special cases.
To format numbers, set your conditions in square brackets followed by the format and separated by a semicolon from the next format. The first condition that matches will be used. We recommend that you include a default value at the very end.
The following example shows how to display dash when there is no value for the metric.
The example below shows that you can use custom text instead of the original value like the "zero" in the example below.
[=null]—; [>0]0; [=0]zero; (0)
When you use conditions for percentage measures such as
Abandoned Conversations % or
Silence %, use decimal numbers instead of percents, e.g., use 0 instead of 0% and 1 instead of 100%. The example below shows a condition for more than 10% and more than 5%.
[>0.1]Over ten percent; [>0.05]Over five percent; Under five percent
When you use conditions for duration measures such as
Talk Time or
Activity Time, use seconds in the conditions.
The example below shows a condition for one hour (3600 seconds) and a condition for one minute (60 seconds).
[>3600]Over one hour; [>60]Over one minute; Under one minute
For more advanced number formatting techniques, please see the following articles:
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.