Dollars and Percentages

👤 This documentation is intended for SQL Users.

Formatting as Dollars

To format a numeric column as dollars, use ":$" in the formatter:

select [my_numeric_column:$] from...

For example, to format the total price as dollars:

select [sum(price):$] from purchases;

This will display a comma-delimited number with a dollar sign and two decimal points:

Formatting as Percentage

To format a numeric column as a percentage, use ":%" in the formatter:

select [my_numeric_column:%] from...

For example, to format the fraction of users who purchase as a percentage:

select [cast(count(distinct purchases.user_id) as numeric)/count(1):%]
from purchases left join users on user_id = users.id

This will display an integer percentage with a percent sign: