Level Function (Report Builder and SSRS)
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Returns the current level of depth in a recursive hierarchy.
You can create and modify report definitions (.rdl) 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. For more information, see Designing Reports in Report Designer and Report Builder (SSRS) on the Web at microsoft.com.
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: