Red Gregory

View Original

Notion Tip: Calculate With Numbers In Relations/Text Properties

Functions used in this scenario:

  • toNumber

  • Slice

The Scenario

This table shows a list of historical organizations, the year they started, and the year they dissolved. “Year Started” and “Year Dissolved” are page titles related from an external timeline database.

Questions To Answer

I converted text properties into numbers with “toNumber” function.

Find number of years the organization was active?

toNumber(prop("Year Dissolved")) - toNumber(prop("Year Started"))

Find all organizations that dissolved before the year 2000?

toNumber(prop("Year Dissolved")) < 2000

Minimize The Scenario

Here, I want to merge “Year Started” and “Year Dissolved” properties into the page title. I can still return answers to the same two questions above with toNumber and slice functions.

Questions To Answer

I used “Slice” to isolate each year, then converted “toNumber” before finding the difference.

Find number of years the organization was active?

toNumber(slice(prop("Name"), -4)) - toNumber(slice(prop("Name"), -11))

Find all organizations that dissolved before the year 2000?

toNumber(slice(prop("Name"), -4)) < 2000

See this content in the original post

View Example In Notion