Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 3.09 KB

report-builder-functions-countrows-function.md

File metadata and controls

60 lines (42 loc) · 3.09 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom
CountRows function in a paginated report
Learn about the CountRows function, which returns the number of rows in a specified scope, including rows with null values in a paginated report.
maggiesMSFT
maggies
03/07/2017
reporting-services
report-design
conceptual
updatefrequency5

Report Builder functions - CountRows function in a paginated report (Report Builder)

[!INCLUDEssrs-appliesto] [!INCLUDE ssrs-appliesto-ssrs-rb] [!INCLUDE ssrs-appliesto-pbi-rb] [!INCLUDE ssrb-applies-to-ssdt-yes]

Returns the number of rows in the specified scope in a paginated report, including rows with null values.

Note

[!INCLUDEssRBRDDup]

Syntax

  
CountRows(scope, recursive)  

Parameters

scope
(String) The name of a dataset, data region, or group that contains the report items to count.

recursive
(Enumerated Type) Optional. Simple (default) or RdlRecursive. Specifies whether to perform the aggregation recursively.

Return Type

Returns an Integer.

Remarks

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, see Aggregate Functions Reference (Report Builder and SSRS) and Expression Scope for Totals, Aggregates, and Built-in Collections (Report Builder and SSRS).

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

Example

The following code example shows an expression that calculates the number of rows in a row group named GroupbyCategory (based on the expression [Category]).

="Number of rows: " & CountRows("GroupbyCategory")  

See Also

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)