Skip to main content

FORMAT_NUMBER

Description​

Returns a formatted string using a unit symbol, UNITS: "K", "M", "B", "T", "Q"

Syntax​

FORMAT_NUMBER(<val>)

Parameters​

ParameterDescription
<val>The value is to be calculated with unit

Return Value​

The formatted string using a unit symbol.

Example​

SELECT format_number(123456.0);
+-----------------------------------------+
| format_number(cast(123456.0 as DOUBLE)) |
+-----------------------------------------+
| 123K |
+-----------------------------------------+
SELECT format_number(1000000.00);
+-------------------------------------------+
| format_number(cast(1000000.00 as DOUBLE)) |
+-------------------------------------------+
| 1M |
+-------------------------------------------+
select format_number(-1000000000000000);
+--------------------------------------------------+
| format_number(cast(-1000000000000000 as DOUBLE)) |
+--------------------------------------------------+
| -1Q |
+--------------------------------------------------+