November 03, 2011

Auto Increment Row Number in a Report Table

To add auto increment column we can use "RunningValue" function in SSRS.

To do this add below expression to the cell in the group you want to add auto increment column.

=RunningValue(<Value Field (Must be the grouped field)>,CountDistinct,"<DataSet>")

Example:-
=RunningValue(Fields!Name.Value,CountDistinct,"DataSet")




8 comments:

  1. use simple one

    Rownumber(nothing)

    ReplyDelete
    Replies
    1. If there are distinct rows, 'Rownumber(nothing)' is repeat the row number.

      Delete
    2. also if you are using an aggregate function (SUM) and an order by that aggregate function at the tablix level your row numbers will not be sequential. But the above solution works for this

      Delete
    3. rownumber(nothing) does not give you a row count, (like a rank column in the post), it counts the incidences, it is good for another purpose

      Delete
  2. worked for me . Thanks for posting

    ReplyDelete
  3. worked fine for me too. Thank you and keep going...

    ReplyDelete
  4. Works great. I had to read about a dozen other posts before finding this simple solution. Thanks!

    ReplyDelete
  5. AnonymousJune 26, 2019

    Worked 4 me! Ty

    ReplyDelete

LinkWithin

Related Posts with Thumbnails