I have found this code below to be very helpful when trying to do rankings in SSRS.
Public dim Previousvalue as Integer =0
public dim SourceRank as Integer =1
Public Function Rank(sourceValue as Integer ) As Integer
if Previousvalue >sourceValue
SourceRank =SourceRank +1
And in your textbox where you would like to get the rank please put the expression
So where do you stick this code to create the function?
For Report Builder:
In Design view, right-click the design surface outside the border of the report and click Report Properties.
In Custom code, type the code. Errors in the code produce warnings when the report runs.
To add code to a report
- On the Report menu, click Report Properties.
NoteIf the Report menu is not available, click within the report design area.
- On the Code tab, in Custom code, type the code.
I hope this helps!