Skip to main content
Question

Duration between record creations

  • Apr 3, 2025 7:33 PM UTC
  • 2 replies
  • 122 views

Forum|alt.badge.img

I have a project log table that tracks each status change for a related project.
How do I calculate the duration of time in each status?

Essentially the difference (in days) between each record Start Date.

I'm thinking this can be done in a report formula field

 

2 replies

MarkShnierYou
Forum|alt.badge.img+24

It's actually an interesting question but I don't recall anyone posting an answer to this type of question.  I'm sure it can be done using Formula Queries.  You would do one query to get the list of Record ID's which are less than the one you are on.  They come back in Record ID sequence so the last one on the list its the highest one.  Then parse that number off the end of the string and use Get Field value to access the date field from that record.

 

If you have a small budget for an hour of consulting time we could get that working on a zoom call and you might learn something about Formula Queries.   If not then maybe someone else will post an answer or I'm might get curious when I had spare time and figure it out.  The fact that your status updates are in Record ID sort should allow a solution.


Top Step
Forum|alt.badge.img+9
  • Registered
  • Oct 29, 2026 4:11 PM UTC

I’d avoid formula queries for this since they can slow the app down. Instead, link each status record directly to the one before it, so nothing depends on matching dates.

On the Projects table, add a summary field for the Maximum Record ID# of its log records, called [Latest Log ID]. Look that up into the log table, and when a new status record is created, write that value into a numeric [Previous Log ID] field. A form rule or a pipeline step can fill it in at creation.

Make [Previous Log ID] the reference field for a relationship from the log table to itself. Each status record is now tied to exactly the one it replaced, and lookup and summary fields can carry dates in either direction.

To set the old record’s End Date, have a pipeline trigger on the new record, use a Lookup Record step on [Previous Log ID], and update that exact record’s End Date to the new Start Date. Because it targets the actual Record ID, the date can never land on the wrong record.

Then a formula numeric field gives you the days in each status, with the current status counting up to today:

ToDays(If(IsNull([End Date]), Today(), [End Date]) - [Start Date])

From there a summary report grouped by status can total or average it.

Want more detail? I wrote a full walkthrough here: https://www.topstep.tech/blog/quickbase-days-in-each-status-log