Relations

Workaround: How To Use Rollups In Notion Calculations

Screen Shot 2019-12-31 at 12.54.20 PM.jpg

➕Rollup Value Workaround

Relational databases are an incredible Notion feature, however, I learned rather quickly after playing around with formulas that rollups are incompatible with Notion calculations.

For example, if I want to grab the total price of an item from an inventory database, place it into a sold database of which will become a component of a larger sum of items sold formula ... well, this shows up:

prop("Price 1") + prop("Price 2")
Screen Shot 2019-12-31 at 12.42.13 PM.jpg

It only combines 45 and 20 to make 4520 instead of running an addition calculation. To fix this numerical frustration, the workaround is simple. We need to use toNumber:

toNumber(prop("Price 1")) + toNumber(prop("Price 2"))
Screen Shot 2019-12-31 at 12.39.53 PM.jpg

Now let's discuss a workaround for rollup values within a complete database with multiple variables. The final database properties are as follows:

  • Quantity - Number

  • Item - Relation

  • Price - Rollup

  • Sent - Checkbox

Here is what the sum formula will determine:

If Sent 1 and Sent 2 checkbox true, then multiple Quantity 1 by Price 1 → add sum to Quantity 2 multiplied by Price 2

((prop("Sent 1") and prop("Sent 2")) == true) ? (prop("Quantity 1") * toNumber(prop("Price 1")) + prop("Quantity 2") * toNumber(prop("Price 2"))) : 0 
Screen Shot 2019-12-31 at 12.40.06 PM.jpg