CountRows Function (Report Builder and SSRS)
Applies To: SQL Server 2016
Returns the number of rows in the specified scope, including rows with null values.
(String) The name of a dataset, data region, or group that contains the report items to count.
(Enumerated Type) Optional. Simple (default) or RdlRecursive. Specifies whether to perform the aggregation recursively.
Returns an Integer.
CountRows counts all rows in the specified scope, including rows that have null values.
The value of scope cannot be an expression and must refer to the current scope or a containing scope.
For more information about recursive aggregates, see Creating Recursive Hierarchy Groups (Report Builder and SSRS).
The following code example shows an expression that calculates the number of rows in a row group named
GroupbyCategory (based on the expression
="Number of rows: " & CountRows("GroupbyCategory")
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)