Wanna see something cool? Check out Angular Spotify ðŸŽ§

# Notion: Rounding to 2 Decimal Places

Notion is an exceptional tool that I have been using for quite some time. Its underlying database structure, which resembles a table, offers customization options with various views such as gallery, board, list, and calendar.

Recently, I created a simple database to track my teamâ€™s sprint progress on a weekly basis. The database includes fields for the sprint name, date, number of closed tickets, number of open tickets, and a formula column to automatically calculate the percentage of closed tickets.

The formula is straightforward: closed tickets / (closed tickets + open tickets). In Notion, you can directly reference column names in formulas. For example, I have a formula like "Complete" / ("Complete" + "Open"), which is represented as prop("Complete") / (prop("Complete") + prop("Open")) when copied and pasted.

To visualize the result, I have included screenshots below:

As you can see, the result is a long decimal number. To round it to two decimal places, we can use a workaround similar to rounding numbers in JavaScript.

## Formula

Hereâ€™s the formula to round to two decimal places:

round(prop("Some column") * 100) / 100

You can adjust the number of zeros to round to the desired decimal places. For example, to round to one decimal place, use 10; to round to three decimal places, use 1000.

This is how it appears on the Notion page:

## Why does this work?

Letâ€™s take an example where the result of the formula is 0.531914893617. When you multiply it by 100, it becomes 53.1914893617. Rounding it gives you 53. Finally, dividing it by 100 gives you 0.53.

Hereâ€™s the updated result:

Published 2 Jul 2024