How to Display the Elapsed Processing Time of a Report in SSRS

Home > Blogs > SQL Server > How to Display the Elapsed Processing Time of a Report in SSRS

How to Display the Elapsed Processing Time of a Report in SSRS

Like This Blog 3 Peter Avila
Added by September 28, 2015

The amount of time it takes to process a report can be useful information for performance auditing. Although there isn’t a built-in field in SQL Server Reporting Services that holds the elapsed processing time, it’s easy to create this functionality using the ExecutionTime built-in field and the Now VB.Net function in SSRS.

For instructor-led SQL Server Training see our complete course schedule.  

The ExecutionTime is the moment when report processing starts. When used in the expression of a textbox, the Now function returns the time when the report is rendered. Rendering comes right after report processing. This means we can easily calculate the processing time simply by subtracting Now from ExecutionTime.

Function Implementation

One way to implement the logic is to put it into a custom function and then call the function from the expression of a textbox. This is clean, the code is easy to read and so it’s also easy to maintain. The downside is that you have more than one component to the solution; so, if you want to copy this functionality into other reports, you’ll have to copy and paste both the function and the textbox. My preference would be for this approach because “clean and easy to maintain” usually leads to smoother running programs!

If you’ve never created custom code in SSRS before, read my article on Using Custom Code in SSRS to see how it’s done. Then create the following function that will both calculate the elapsed processing time and return it as a string in the format mm:ss.

Single Expression Implementation

Another way to implement the logic is to use a single expression in a textbox (right-click the textbox and select Expression…) that does everything. This is a bit messier, the expression has a whole bunch of things piled into it making it harder to read and maintain, but all you have to do to put it into another report is copy just that one textbox containing the following expression, which also displays the results in the format mm:ss.



Peter Avila
SQL Server Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Agile Methodology in Project Management

0 114 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

Creating Users and Managing Passwords in Microsoft Office 365

0 497 3

In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365.

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 478 3

In this IT Security training video, Security expert Mike Danseglio (CISSP / CEH) will perform several malware investigations including rootkits, botnets, viruses, and browser toolbars.

Write a Comment

See what people are saying...

  1. Avatar Adrian Hernandez

    You could also use :
    =”Execution Time: ” +
    CStr(Variables!ReportExecutionTime.Value.Subtract(Globals!ExecutionTime).Minutes) + ” min” + “, ” +
    CStr(Variables!ReportExecutionTime.Value.Subtract(Globals!ExecutionTime).Seconds) + ” sec”

    If placed in an expression at the footer of a report it’s more accurate as it’s calculated at the end. I agree with other comments, the time is an approximation as it doesn’t seem to really get the accurate time for rendering the full report. For example, above expresion returns 4 seconds for a report that actually took almost 8 seconds.

  2. Avatar Dave Kent

    Hi Peter,
    Thanks for this code, it’s a good starting point, however the reported timing seems shorter than reality. I suspect it is not bringing back the true report Execution Duration as the Now() function doesn’t seemed to be invoked at the end of report processing, but rather when it is called in the Function or when SSRS gets around to dealing with that expression field. It would be good if there were some Event in SSRS where the report has ended and you could execute code like a lot of VBA applications have.

  3. Avatar Mihai-Constantin Pascu

    GREAT !! Thank you!

Share your thoughts...

Please fill out the comment form below to post a reply.