Search code examples
reporting-servicesssrs-2008

Auto Row Number in SSRS Table with Grouped Rows


I am working with SSRS 2008. In one of my report I have a table with 3 columns. Sr. No, Column 1, Column2. Sr. No is -RowNumber("DataSet") and other are two are data set columns. I have grouped (Row Group) my table on Column 1 and Column 2. This is ok but the Sr.No column doesn't show right count it shows row number of grouped row e.g 2,4,9,10 so on. I want to keep the Sr.No or row number after grouping and on top of my table I want to show the count of rows in my table after grouping.

please suggest


Solution

  • For distinct numbering of rows you can try this:

    =RunningValue(CountDistinct("YourTableName"),Count,"YourTableName")
    

    If you have only one grouping level in your report, you could group your values in the SQL query and then add new column ROW_NUMBER() OVER(...) numbering your rows in SQL query already.