Calculating custom case age in reports

Standard case reports uses the Units picklist in reports filter to display the age of a case. This is calculated in the backend of Salesforce and not something you can edit, even as the System Admin.

In reports you can view the minutes, hours, or days. But you can only view one at a time.

If you ever have a requirement to view multiple ages at once you’ll need to create new formula fields (number) on the Case Object.

The following formulas use the IF operator. The IF operator works like this: IF(logical_testvalue_if_truevalue_if_false)

So, breaking down what the first formula means: If the Case is Closed then subtract the created date from close date. If the Case is not closed then subtract the created date from the time now.

  • Age in Days – IF (IsClosed,ClosedDate – CreatedDate,NOW() – CreatedDate)

The following formula are the same, but you need a way to convert from days to hours. So just multiply by 24.

  • Age in Hours – IF( IsClosed , (ClosedDate – CreatedDate) *24, (NOW() – CreatedDate ) *24)

To convert days to minute multiply by 1440 (24 hrs x 60 minutes)

  • Age in Minutes – IF( IsClosed , (ClosedDate – CreatedDate) *1440, (NOW() – CreatedDate ) *1440)

And if you’re working in a really stressful industry where every second matters just multiply by 86400 (24 hrs x 60 minutes x 60 seconds).

  • Age in Seconds– IF( IsClosed , (ClosedDate – CreatedDate) *1440, (NOW() – CreatedDate ) *86400)

You can now add these fields to reports or page layouts. Everyone on the team can now use as many or as few of the case ages as they please.

Leave a comment