Every once in a while I come across a scenario where I really want to know how long it took a report to render. This is often the case if the report is taking abnormally long, but some environments may want this kind of information included in its report footer or header. Here is a quick script that you could add to your report that will tell you exactly how long it took to render.
Try It Out
Add a new textbox to your report and add the below script as an expression.
="Render Duration: " +
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).TotalSeconds < 1, "0 seconds",
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes & " minute(s), ", "") +
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds & " second(s)", ""))
Now, just execute your report to see your results.
Hopefully your reports don’t take nearly an hour to render, but if it does, just add another section above minutes and use .Hours instead.
Also note that if your report has multiple pages or expands and collapses, the value will change. To help with this, you could create a variable and set the variable to this value. That way the duration would stay consistent across page breaks and report rendering. I hope that you enjoyed this quick post.
Until next time, “keep your ear to the grindstone” – Good Will Hunting
Brian K. McDonald, MCDBA, MCSD
Business Intelligence Consultant – Pragmatic Works Consultants