The Calculate extension adds calculating capabilities that will hopefully one day be integrated with calc!


You could use the Copy Extension button below to individually install this extension. To install, just paste anywhere in your Roam graph and click "Yes, I Know What I'm Doing".

Manual Installation

If the extension doesn't work after using the copy extension button above, try installing manually using the instructions below.

First create a block with the text {{[[roam/js]]}} on any page in your Roam DB. Then, create a single child of this block and type three backticks. A code block should appear. Copy this code and paste it into the child code block in your graph:

var existing = document.getElementById("roamjs-calculate");
if (!existing) {
  var extension = document.createElement("script");
  extension.src = ""; = "roamjs-calculate";
  extension.async = true;
  extension.type = "text/javascript";

Finally, click "Yes, I Know What I'm Doing".


Type {{calculate:}} into a block. Everything to the right of the colon will represent the expression to be calculated.

An expression could be one of four options:

  • A number
  • A tag
  • A binary operation
  • A function

Numbers include positive, negative, and decimal values. Tags are pages in either [[]], #[[]], or # formats. A binary operation combines two expressions with one of these four operations:

  • +
  • -
  • *
  • /

A function is a higher level macro that take one or more expressions as input and produces an output. The syntax of each function is {name:(expression)+}. The supported functions are:

  • attr - takes two tag names as input, returning the value assigned to the attribute with the second name on the page with the first name.
    • {attr: [[Example Project]] [[Due Date]]} returns the value assigned to the Due Date attribute on the Example Project page.
  • daily - takes one or more tags as input, and returns all the daily note pages that reference those tags in the same block
    • {daily: [[Example Project]] [[DONE]]} returns all the daily note pages that have blocks with both the DONE and Example Project tags
  • max - Takes multiple values as input and returns the maximum value. Handles both numbers and dates.
    • {max: 4 7} will return 7.
  • since - Takes a date value as input and will return the number of days since that day
    • {since: [[January 20th, 2021]]} will return 2 if today was January 22th, 2021.



This extension is brought to you by RoamJS! If you are facing any issues reach out to or click on the chat button on the bottom right.

If you get value from using this extension, consider sponsoring RoamJS by clicking on the button below!

Other Extensions