, ,

Hi All,

RowNumber is a very commonly used function in Reports. It returns the running count of all the rows in the specified scope.

Scope: The Scope parameter is set to a String constant that is equal to either the name of the containing group, the name of the containing DataRegion or the name of the DataSet.

If a DataRegion or Grouping is specified then the running value is reset accordingly(i.e. when group expression changes or for each different instances of DataRegion), while not in case of specifying DataSet as it remains the same.


  • While generating a report directly from DB we can fetch the RowNumber as:
Syntax:- Row_Number() OVER (ORDER BY Scope) AS 'Row No.'
Example: Row_Number() OVER (ORDER BY UserName) AS 'Row No.'


  • And while writing the Expressions for fields in SSRS reports :
Synatx: =RowNumber("Scope")
Example: =RowNumber("DataSet1")


  • The following example provides a running count of rows in the outermost data region.


Thanks !!!