Calculating Values in a column(sub columns)
I have a column which is called 'ActionCode' my data looks like this:
LoginName WorkItemID TL ActionCode
CDS0008 685777 19 21
CDS0008 685861 19 21
CDS0008 685977 19 23
CDS0008 686249 19 23
CDS0008 686377 19 21
CDS0008 686392 19 21
CDS0008 686443 19 20
CDS0008 686502 19 21
CDS0008 687723 19 21
My report however
LoginName WorkItemID [ActionCode] Total
[LoginName] [WorkItemID] [Count(ActionCode)]
Total [Count(ActionCode)]
----------------------------------------------------------------------
ActionCode gets split into three Columns 20, 21, 23
with Work ItemID 1 0 0
Work ItemID 1
0 0
0 1 0
and Totals
2 1 0
How can I calculate on these three values? 2, 1, and 0 I woul like to have an expression 2/(2+1) where 2 is ActionCode.Value(of this sub column) and 1 is ActionCode.Value(of this next sub column)
Any Help appriciated thanks
February 8th, 2011 10:45am
I have a column which is called 'ActionCode' my data in the DB looks like this:
LoginName WorkItemID TL ActionCode
CDS0008 685777 19 21
CDS0008 685861 19 21
CDS0008 685977 19 23
CDS0008 686249 19 23
CDS0008 686377 19 21
CDS0008 686392 19 21
CDS0008 686443 19 20
CDS0008 686502 19 21
CDS0008 687723 19 21
My report however
LoginName WorkItemID [ActionCode] Total
[LoginName] [WorkItemID] [Count(ActionCode)]
Total [Count(ActionCode)] (would like an expression here based
on ActionCode Totals)
----------------------------------------------------------------------
ActionCode gets split into three Columns 20, 21, 23
with Work ItemID 1 0 0
Work ItemID 1
0 0
0 1 0
and Totals
2 1 0
How can I calculate on these three values? 2, 1, and 0 I woul like to have an expression 2/(2+1) where 2 is ActionCode.Value(of this sub column) and 1 is ActionCode.Value(of this next sub column)
Any Help appriciated thanks
Free Windows Admin Tool Kit Click here and download it now
February 9th, 2011 9:39pm
Hi,
Could you please tell me what's the version of your Reporting Services? And where you want to place the result of the calculation in? Base on my understanding, to
achieve your requirement, I would like to suggest you to use custom code. I have created a sample report, which include the calculate result after Total cells, the calculate result is that TotalCount(ActionCode)/(TotalCount(ActionCode)+TotalCount(NextActionCode)),
and the calculate result of last column is 1, please refer to my report:
I add a matrix to the report, and write the following custom code:
Public Shared Current As Integer = -1
Public Shared Values As System.Collections.Generic.List(Of Integer)
Public Shared Function Add(ByVal value As Integer) As Integer
If (Values Is Nothing) Then
Values = New System.Collections.Generic.List(Of Integer)
End If
Values.Add(value)
Return value
End Function
Public Shared Function Calculate() As Double
Current = Current + 1
If Current = (Values.Count - 1) Then
Return 1
End If
Return CDbl(Values(Current)) / CDbl(Values(Current) + Values(Current + 1))
End Function
And then, in the bottom Total cells, I input the expression:
=Code.Add(Count(Fields!ActionCode.Value))
In Calculate cells, use the expression:
=Code.Calculate()
I have uploaded the report file, you can download and refer to it:
http://cid-854fa6d2b7d88cc7.office.live.com/self.aspx/Work/CalculatingValuesInAColumn.rdl
Here is the result graph.
If I have misunderstood, please feel free to let me know.
Thanks,
Albert Ye
February 15th, 2011 10:03pm