Red Gregory

View Original

Notion Formula: Find Progress Between Date Range

Step 1: Create A Date Range Property

Step 2: Find Percentage Of Range Complete

Insert name of date property created above where it applies.

(divide(dateBetween(now(), start(prop("INSERT PROPERTY NAME")), "days"), dateBetween(end(prop("INSERT PROPERTY NAME")), start(prop("INSERT PROPERTY NAME")), "days")) > 0) ? (round(100 * divide(dateBetween(now(), start(prop("INSERT PROPERTY NAME")), "days"), dateBetween(end(prop("INSERT PROPERTY NAME")), start(prop("INSERT PROPERTY NAME")), "days"))) / 100) : toNumber("")

Breakdown

(divide(dateBetween(now(), start(prop("INSERT PROPERTY NAME")), "days"), dateBetween(end(prop("INSERT PROPERTY NAME")), start(prop("INSERT PROPERTY NAME")), "days"))

  • Divide two following results:

  • Find number of days between the start of the range and today.

  • Find total number of days inside the range.

> 0) ?

  • If result of division is greater than 0 … (signaling that today is within the range)

(round(100 * divide(dateBetween(now(), start(prop("INSERT PROPERTY NAME")), "days"), dateBetween(end(prop("INSERT PROPERTY NAME")), start(prop("INSERT PROPERTY NAME")), "days"))) / 100)

  • … If greater than 0, display this calculation:

    • Divide two following results:

      • Find number of days between the start of the range and today.

      • Find total number of days inside the range.

    • … And round result of division (more about rounding numbers here)

: toNumber("")

  • Otherwise, create an empty space

An Emoji Alternative

More about progress bar and the slice function here.

if(dateBetween(end(prop("Date 2")), now(), "days") < 0, slice("⌬⌬⌬⌬⌬⌬⌬⌬⌬✓", 0, dateBetween(now(), start(prop("Date 2")), "days") / dateBetween(end(prop("Date 2")), start(prop("Date 2")), "days") * 10) + " " + "100%", if(divide(dateBetween(now(), start(prop("Date 2")), "days"), dateBetween(end(prop("Date 2")), start(prop("Date 2")), "days")) > 0, slice("⌬⌬⌬⌬⌬⌬⌬⌬⌬✓", 0, dateBetween(now(), start(prop("Date 2")), "days") / dateBetween(end(prop("Date 2")), start(prop("Date 2")), "days") * 10) + " " + format(round(divide(dateBetween(now(), start(prop("Date 2")), "days"), dateBetween(end(prop("Date 2")), start(prop("Date 2")), "days")) * 100)) + "%", ""))

View Example In Notion


See this gallery in the original post