Global References in SSRS

The Built-in Fields Collection includes the Global references in SSRS. The references include the global variable, which is pre-defined by Microsoft. These are the standard SSRS Global References variables used in every report that we design, such as Page Numbers, Total Page Numbers, etc.

List of Global References in SSRS

The following is the list of available Global References in SSRS.

List of Available Global Variables

and their description is as follows

MemberData TypeDescription
ExecutionTimeDateTimeIt will display the date and time of report execution.
PageNumberIntegerIt will return the current page number. It will assign 1 to the first page, and then it will increment by 1. If there are any page breaks, then this will return the result as per the page breaks. You can control the numbers by the RestPageNumber property in Page Break. You have used this in either the Page header or Footer.
ReportFolderStringThis will return the folder path that contains the report.
ReportNameStringThis will return the report name that you assigned while creating the report.
ReportServerURLStringThis will return the report Server URL on which the current report runs.
TotalPagesIntegerIt returns the total number of pages returned by the report.

If the report doesn’t have the page breaks then this will return the same result as OverAllTotalpages

PageNameStringIt returns the name of the page.

Use this in either the SSRS Page header or the Footer.

OverAllPageNumberIntegerReturns the Current Page Number. This value is not affected by the ResetPageNumber property in Page Breaks. You can use this in either the Page header or the Footer.
OverAllTotalpagesIntegerReturns the Total Number of Pages. This value is not affected by the ResetPageNumber property in Page Breaks. This is used in either the Page Header or Footer.
RenderFormatRenderFormatIt returns the name of the renderer that we configured in the Reporting Service configuration file.

Global References in SSRS Example

For this example, We are going to use the below-shown DataSet. Please refer to the Shared Data Source and Dataset articles to understand the steps involved in creating Shared Data sources and Dataset that we used for this report.

The Custom SQL query that we used in the above Dataset is:

-- Build-in Fields Example
SELECT Prodcat.EnglishProductCategoryName,prodSubcat.EnglishProductSubcategoryName,
prod.EnglishProductName, prod.Color, fact.[TotalProductCost], fact.SalesAmount,
fact.TaxAmt, fact.[OrderDate], fact.[ShipDate]
FROM dbo.DimProduct as prod
INNER JOIN dbo.DimProductSubcategory AS prodSubcat ON
prod.ProductSubcategoryKey = prodSubcat.ProductSubcategoryKey
INNER JOIN dbo.DimProductCategory AS Prodcat ON
prodSubcat.ProductCategoryKey = Prodcat.ProductCategoryKey
INNER JOIN dbo.FactInternetSales AS fact ON
fact.ProductKey = prod.ProductKey
WHERE SalesAmount >= 3500

To explain the usage of the Global resources in SSRS Reports, We are going to use the below-shown report.

Please refer to the Table Report and Format Table article to understand the steps involved in creating and formatting a Table Report, and see the Grouping in Table article for Grouping techniques.

Simple Table Report

To add the SSRS Global variable, you have to drag and drop the required variable onto the Page Header or Footer.

For now, we are adding the ReportName variable to the header. I suggest you refer to the Add Page Headers and Footers article to understand the steps involved in adding headers & Footers. Let me show you the report preview

Add Report Name Global References Variable 3

Click on the Preview tab to see the report preview. From the below screenshot, you can see that the SSRS global variable is showing the report name.

View ReportName global variable 4

Let me format the Global variable. If you observe the Item, it is a text box. So please right-click on the variable and select the Text Box Properties option.

Format Global References Variable 5

Once you select the Text Box Properties.. option, a new window called Text Box Properties will open.

Under the Font tab Please change the text box font. First, we will change the font family Property to Cambria, Size to 14pt, Font Style property to Bold, and color to dark Green. I suggest you refer Add TextBox article to understand the formatting options

Change font of a Add Global References Variable 7

Click the OK button to close the properties window. Let me show you the Report Preview. Now you can see the Formatted Global Variable i.e., Report Name

Add Global References Variable 8

Let me add two more variables to the existing report, and this time add them to the Page Footer.

Add ReportName Global References Variable in SSRS 9

You can see them in the report preview.

View ReportName Global References Variable 10

If you require to combine one or two global variables or to create a complex variable using the Global variable, then you can use the Expression to built one.

Here we added one Empty TextBox to the page footer, and right-click on it will open the context. Please select the Expression option.

Expression 11

Once you select the Expression.. option, a new window called the Expression will open.

Use this expression window to combine one or more global variables. Here we will display the Page Number along with the Total pages in one text box.

=Globals.PageNumber & " of " & Globals.TotalPages
Combine multiple Global References Variables 12

Once you complete with the expression, Please click the OK button to close the expression window. Let me show you the report preview. The report is large so let me scroll down to the end of the first page

Add Global References Variable 14

Let me navigate to the Last page. As you can see the page number updates as 37.

Add Global References Variable 15