Formatting large numbers for readability¶
A large number with many digits can be hard to parse. To format hundreds of thousands, millions, or billions you can use the following techniques:
Conditional Formatting is the best tool for this job. Click the column header in your Explorer or Worksheet, select Conditional Formatting, set Style to Unit
, and set the Base Unit and Precision as needed. For instance, if you have a metric of megabytes, set the Base Unit to megabytes (MB)
and Precision to 2
. This will make 1234567.89
display as 1.23TB
. Conditional formatting only alters the appearance of the data, it does not affect the underlying numbers.
Single Stat dashboard panels can be ideal for this purpose. In your Explorer or Worksheet, filter the data to the statistic you want to show, then create a dashboard panel. Use the right-side settings to control unit size and display options.
If you want to produce a new string column describing the data in a more friendly way, you can also use OPAL for this. For instance, if you know your numbers are at least in the millions, this OPAL will produce a string column describing them. number=11527819
produces str=11.52M
.
make_col scaledNumber: ceil(float64(number) / 1000 / 1000, 2)
make_col str: string(scaledNumber) + "M"
If the number column has many different sizes, you can handle that with case
:
make_col format: case(
number < pow(10, 3), string(number),
number < pow(10, 6), string(ceil(float64(number) / pow(10, 3), 2)) + "k",
number < pow(10, 9), string(ceil(float64(number) / pow(10, 6), 2)) + "M",
number < pow(10, 12), string(ceil(float64(number) / pow(10, 9), 2)) + "B"
)