Reporting Services - Running Total at Page Footer
I was questioned by my client to display the Running Total at the Page Footer ,
Initially thought it was an easy task ...Just Refer the Text Box where the field was Placed and do some small Rework would yield the Result,,But NO !!!! !!!It Turned out to be harder than what i expected.
After some amount of googling,I have Written this Sample Vb Script which will display Running total at the page Footer.
Copy Paste this Vb Code in your Report Code.
Public Shared PageTotal As System.Collections.Generic.Dictionary(Of Integer, Decimal)
Public Shared Function GetTotal(ByVal Item As Integer, ByVal Amount As Decimal) As Decimal
Dim Count As Integer
Dim total As Decimal = 0
If PageTotal Is Nothing
Then PageTotal = New System.Collections.Generic.Dictionary(Of Integer, Decimal)
End If
If Not PageTotal.ContainsKey(Item)
Then PageTotal.Add(Item, Amount)
End If
For Count = 1 To Item total = total + PageTotal(Count)
Next
Return total
End Function
Use the Expression in your Report Footer..
Code.GetTotal(Globals!PageNumber,Sum(ReportItems!YourMeasure.Value))
Change the Expression and Paste the Measure which you need to display.
Now You Can See the Magic of the Vb Scipt !! ! ! !