Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 3.48 KB

report-builder-functions-rownumber-function.md

File metadata and controls

57 lines (41 loc) · 3.48 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom
RowNumber function in a paginated report
Use the RowNumber function in Report Builder to return a running count of the number of rows in a paginated report for the specified scope.
kfollis
kfollis
09/25/2024
reporting-services
report-design
how-to
updatefrequency5

Report Builder functions - RowNumber 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 a running count of the number of rows for the specified scope in a paginated report.

Note

[!INCLUDEssRBRDDup]

Syntax

  
RowNumber(scope)  

Parameters

scope
(String) The name of a dataset, data region, or group, or null (Nothing in [!INCLUDEvisual-basic]), that specifies the context in which to evaluate the number of rows. Nothing specifies the outermost context, usually the report dataset.

Remarks

RowNumber returns a running value of the count of rows within the specified scope, just as RunningValue returns the running value of an aggregate function. When you specify a scope, you specify when to reset the row count to 1.

scope cannot be an expression. scope must be a containing scope. Typical scopes, from the outermost to the innermost containment, are report dataset, data region, row groups or column groups.

To increment values across columns, specify a scope that is the name of a column group. To increment numbers down rows, specify a scope that is the name of a row group.

Note

Including aggregates that specify both a row group and a column group in a single expression is not supported.

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).

Code Example

The following is an expression that you can use for the BackgroundColor property of a Tablix data region detail row to alternate the color of detail rows for each group, always beginning with White.

=IIF(RowNumber("GroupbyCategory") Mod 2, "White", "PaleGreen")  

Related content