Browse 531 attributed reviews, viewable separately for our classroom and online training
Reporting Services - report and group variables
Part one of a three-part series of blogs

If you're not sure when - or whether - you should be using report or group variables in SSRS, read this blog to find out how to speed up your reports and solve other problems.

  1. SQL Server Reporting Services Variables (this blog)
  2. Report Variables in SSRS
  3. Group Variables in SSRS

Posted by Andy Brown on 21 June 2012

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

SQL Server Reporting Services Variables

Have you ever wondered why SSRS (as I'll call SQL Server Reporting Services from now on) includes a tab for Variables?

Variables tab

You can create variables either for a report or for a group.


Me too!  So I thought I'd do an in-depth blog on how - and why - you would use variables in Reporting Services (and in the process unearth one of the odder bugs).

Scope of Variables

I thought I'd start with an explanation of what variables are, which is simply expressions with wider scope than would be the case for a textbox. 

To prove this, I've created an example report, which you can download:

Different ticks for report

The ticks are different at report, group and detail level.

The expression to display the ticks is as follows:


What this does is take the current state of a computer's clock cycle, and extract some digits from it to give an impression of how much time has elapsed.  If you look at the figures, you'll see the following:

Scope of expression Value of ticks Calculated
Report (appears in report title) 221,463 When the report first loads
Group (appears in group footer) 221,744 for visible groups When each group first loads
Detail (6 films are visible) 221,775 and 221, 791 When a page loads

Versions of Reporting Services from 2008 onwards calculate textbox expressions afresh for every page as it loads, but variables are evaluated once only for the report (and cached in memory).  This means that group and report variables can save you a lot of processing time.

Now that we know how variables work, let's look at how you might use them, using one example each for report and group variables. 

  1. SQL Server Reporting Services Variables (this blog)
  2. Report Variables in SSRS
  3. Group Variables in SSRS
This blog has 0 threads Add post