Create Sum of calculated columns in Microsoft Reporting Services like Fibonacci series

96 Views Asked by At

Help me, please.

I have a Tablix with column group that shows values for each month.

Like the exemple:

 JUN/2012|JUL/2012                                                         
 15,00   |26,00                                                               
 15,00   |41,00

I want to sum up the values in the second line, row 2 of second month needs to be value of first month + second month.

Thanks.

1

There are 1 best solutions below

0
On

You could create a function in the Report Code to keep a running total value, like below:

Dim runningTotals As System.Collections.Hashtable


Public Function AddRunningTotalValue(ByVal dateStr As Object, ByVal amount As Object)
        If (runningTotals Is Nothing) Then
            runningTotals = New System.Collections.Hashtable
        End If
        If (Not runningTotals.Contains(dateStr)) Then
            runningTotals.Add(dateStr, amount)
       End If
       AddRunningTotalValue = amount
End Function

Public Function GetRunningTotalValue(ByVal dateStr)
    If (Not runningTotals.Contains(dateStr)) Then
        GetRunningTotalValue = 0
    End If        
        If (runningTotals.Contains(dateStr)) Then
            For Each dateStrPair As System.Collections.DictionaryEntry In runningTotals
                If dateStrPair.Key.ToString() = dateStr Then
                GetRunningTotalValue = dateStrPair.Value
            End If
        Next
        End If
End Function

Of course you would modify the get function to only return the sum of the month values that you want to add together.