Custom Code in SSRS for summing counts

This is a bit long winded, but I hopeyou get the gist of it

Basically I'm trying to find the potential of workers by saying that if the day is a working day, then the worker can work 8 hours.

I have to do a sum on the following exprssion

=((COUNT(Fields!date.Value) - 
(COUNT(iif(Fields!Day_Type.Value = "Weekend", Fields!Day_Type.Value,
iif(Fields!Description.Value =Nothing, Nothing,Fields!Description.Value))))) * 8))
Obviously, I can't use runing aggregation, so I read that I can use custom code for this task, using this to get the total, which is

Public Function AddTotal(ByVal potential AS integer) AS integer
    Dim totalPotential As integer
        totalPotential = (totalPotential + potential) 
        return totalPotential
End Function

I then put the expression as in the argument for the addTotal function.

Problem is I am getting the figure I would get if I just put the above expression in there. does anybody know why this is?

more ▼

asked Mar 23, 2011 at 09:35 AM in Default

avatar image

160 11 12 17

(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Mar 23, 2011 at 09:35 AM

Seen: 1817 times

Last Updated: Mar 23, 2011 at 09:36 AM

Copyright 2018 Redgate Software. Privacy Policy