TechNet
Export (0) Print
Expand All

Level Function (Report Builder and SSRS)

 

Applies To: SQL Server 2016

Returns the current level of depth in a recursive hierarchy.

System_CAPS_ICON_note.jpg Note


You can create and modify paginated report definition (.rdl) files in Report Builder and in Report Designer in SQL Server Data Tools. Each authoring environment provides different ways to create, open, and save reports and related items.


Level(scope)

Parameters

scope
(String) (Optional). The name of a dataset, group, or data region that contains the report items to which to apply the aggregate function. If scope is not specified, the current scope is used.

Returns an Integer. If scope specifies a dataset or data region, or specifies a nonrecursive grouping (that is, a grouping with no Parent element), Level returns 0. If scope is omitted, it returns the level of the current scope.

The value returned by the Level function is zero based; that is, the first level in a hierarchy is 0.

The Level function can be used to provide indentation in a recursive hierarchy, such as an employee list.

For more information about recursive hierarchies, see Creating Recursive Hierarchy Groups (Report Builder and SSRS).

The following code example provides the level of row in the Employees group:

=Level("Employees")

Expression Uses in Reports (Report Builder and SSRS)
Expression Examples (Report Builder and SSRS)
Data Types in Expressions (Report Builder and SSRS)
Expression Scope for Totals, Aggregates, and Built-in Collections (Report Builder and SSRS)

Community Additions

ADD
Show:
© 2016 Microsoft