How to Build Notion Formula for SLA Countdown With Business Hours Only
🔍 WiseChecker

How to Build Notion Formula for SLA Countdown With Business Hours Only

If you need to track service-level agreement deadlines in Notion, a simple date subtraction formula does not work. The problem is that Notion counts all hours equally, including nights, weekends, and holidays. This article explains how to build a Notion formula that calculates an SLA countdown using only business hours. You will learn the logic behind the formula and get a ready-to-use expression that respects your working schedule.

Key Takeaways: Notion SLA Countdown With Business Hours

  • Business hours definition: Set start and end times (e.g., 9 AM to 5 PM) and exclude Saturday and Sunday.
  • Formula logic: The formula calculates full business days, then adds remaining hours from the start and end days.
  • Limitation: Notion formulas cannot read a separate holidays database, so you must manually adjust for holidays.

ADVERTISEMENT

How the Business Hours SLA Formula Works in Notion

Notion formulas operate on dates and numbers but have no built-in concept of business hours or holidays. To simulate a working calendar, you must break the calculation into three parts. First, determine the number of full business days between the start date and the deadline. Second, calculate the hours contributed by the start day. Third, calculate the hours contributed by the deadline day. The sum of these three parts gives you the total business hours available.

The formula uses the dateBetween function to count days and the hour function to extract the time component. You must also use min and max to clamp hours within the defined business day. The formula assumes a Monday-to-Friday work week and a fixed start and end time, such as 9:00 AM to 5:00 PM. If your work week differs, adjust the numeric values in the formula accordingly.

Prerequisites Before Building the Formula

You need two date properties in your Notion database. One property should be the date and time when the SLA clock starts, for example a ticket creation date. The other property should be the deadline date and time. Both properties must include the time component, not just the date. If you only have dates, the formula will assume midnight as the start time, which may produce incorrect results.

Name the two properties SLA Start and SLA Deadline. You can rename them later, but the formula references these exact names. If you use different property names, replace the names inside the formula.

Steps to Build the Notion Business Hours SLA Formula

Follow these steps to create the formula property in your Notion database. The formula uses a 9:00 AM to 5:00 PM business day with 8 working hours per day. Adjust the numbers 9, 17, and 8 if your business hours differ.

  1. Create a new formula property
    Open your Notion database. Click the plus sign in the last column header. Select Formula from the property type list. Name the property SLA Countdown (Hours).
  2. Define the business day parameters
    In the formula editor, paste the following code. This code sets the start hour (9), end hour (17), and working hours per day (8).
let(
  startHour, 9,
  endHour, 17,
  workHoursPerDay, 8,
  startDate, prop("SLA Start"),
  endDate, prop("SLA Deadline"),
  
  / Full days between start and end /
  fullDays, dateBetween(endDate, startDate, "days"),
  
  / Adjust for weekends: subtract 2 days for each full week /
  weekends, floor(fullDays / 7)  2,
  / Adjust if the range starts on Saturday or Sunday /
  startDay, startDate.formatDate("ddd"),
  endDay, endDate.formatDate("ddd"),
  
  / Count business days /
  businessDays, fullDays - weekends - 
    if(startDay == "Sat", 1, 0) - 
    if(startDay == "Sun", 1, 0) - 
    if(endDay == "Sat", 1, 0) - 
    if(endDay == "Sun", 1, 0),
  
  / Hours from full business days /
  fullDayHours, businessDays  workHoursPerDay,
  
  / Hours on start day /
  startHourOfDay, startDate.formatDate("HH").toNumber(),
  startMinutes, startDate.formatDate("mm").toNumber(),
  startTimeInMinutes, startHourOfDay  60 + startMinutes,
  startBusinessStart, startHour  60,
  startBusinessEnd, endHour  60,
  startClampedStart, max(startTimeInMinutes, startBusinessStart),
  startClampedEnd, min(startClampedStart + 480, startBusinessEnd),
  startDayMinutes, max(startClampedEnd - startClampedStart, 0),
  startDayHours, startDayMinutes / 60,
  
  / Hours on end day /
  endHourOfDay, endDate.formatDate("HH").toNumber(),
  endMinutes, endDate.formatDate("mm").toNumber(),
  endTimeInMinutes, endHourOfDay  60 + endMinutes,
  endBusinessStart, startHour  60,
  endBusinessEnd, endHour  60,
  endClampedStart, max(endTimeInMinutes, endBusinessStart),
  endClampedEnd, min(endClampedStart + 480, endBusinessEnd),
  endDayMinutes, max(endClampedEnd - endClampedStart, 0),
  endDayHours, endDayMinutes / 60,
  
  / Total SLA hours /
  totalHours, fullDayHours + startDayHours + endDayHours,
  
  totalHours
)
  1. Replace property names if needed
    If your date properties are named differently, change prop("SLA Start") and prop("SLA Deadline") to match your property names.
  2. Click Done to save the formula
    Notion will evaluate the formula for every row. If you see an error, check that both date properties exist and contain valid date-time values.

ADVERTISEMENT

Common Issues With the Business Hours SLA Formula

Formula returns a negative number

A negative result means the deadline is earlier than the start date. Verify that the SLA Deadline property contains a date and time after the SLA Start property. If you need to show zero for past deadlines, wrap the formula in max(0, ...).

Weekend subtraction is incorrect

The formula uses English three-letter day abbreviations (Sat, Sun). If your Notion workspace uses a different language, change "Sat" and "Sun" to the abbreviations in your language. For example, in French use "sam" and "dim".

Business hours span multiple time zones

Notion stores dates in the time zone of your workspace settings. If your team works across time zones, all dates must be entered in the same time zone. The formula does not convert time zones automatically.

Holidays are not excluded

Notion formulas cannot query a separate database or list of holidays. To handle holidays, you must either manually exclude them by adjusting the deadline date or use a third-party integration that updates a date property with holiday-adjusted values.

Notion SLA Formula vs Manual Tracking: Comparison

Item Notion Formula Manual Tracking
Calculation speed Instant, updates automatically Requires manual entry each time
Accuracy for business hours High, with proper weekend handling Prone to human error
Holiday support None, must be handled externally Can be accounted for manually
Setup effort Moderate, requires formula editing Low, but repetitive
Maintenance Low, formula works indefinitely High, each row needs individual attention

The Notion formula is the better choice for teams with consistent business hours and a high volume of SLA items. Manual tracking makes sense only for small teams or projects with very few SLA deadlines.

You can now calculate SLA countdowns in Notion that respect business hours and exclude weekends. To extend the formula, add a condition that returns a warning when the countdown drops below a certain threshold, such as 4 hours. For advanced SLA tracking, consider using Notion’s API to import a holiday list into a separate database and reference it with a rollup property.

ADVERTISEMENT