Why SUM is not working in SSRS

Hi,
I'm new to SSRS and am having a problem. I am trying to replicate the value of sum(sum(field)) using lookupsets and custom code function.  I have this little function which works fine.
PUBLIC SHARED FUNCTION CalcPTD2(LookupArray AS OBJECT) AS INTEGER
     DIM i,Total AS INTEGER
     Total = 0
     FOR i = 0 to UBOUND(LookupArray)
           Total = Total + CINT(LookupArray(i))
     NEXT i
 RETURN  Total
END FUNCTION
I call this function with the following call:
Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4"))
The output of this function is a row of data consisting of 28, 47, 35, 43, 41
If I use COUNT on the output of the function like this COUNT(Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4"))) I get the
result of 9
If I use SUM on the output of the function like this SUM(Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4"))) I get the result
of 353
I set up a global counter and it showed it was only entering the function 5 times as expected. So where is the extra data coming from? Is this an invalid use of SUM or COUNT? What is a replacement? Earlier in my report I reference SUM(SUM(Fields!DailyHours.Value)
which is the result I am looking for. I can't reference it here because the matrix is associated with another dataset. And splitting it out into another matrix is not an option.
Thanks in Advance
Ann

Here is a copy of my expressions and a copy of my data. The expressions match up going from left to right
Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4"))
sum(Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4")))
count(Code.CalcPTD2(Lookupset(FORMAT(Fields!REALDATE.Value,"Long Date"),FORMAT(Fields!CallbackDate.Value,"Long Date"),Fields!DailyHours.Value,"DataSet4")))
PUBLIC SHARED FUNCTION CalcPTD2(LookupArray AS OBJECT) AS INTEGER
     DIM i,Total AS INTEGER
     Total = 0
     FOR i = 0 to UBOUND(LookupArray)
           Total = Total + CINT(LookupArray(i))
     NEXT i
 NumberTimes  =   NumberTimes +1
RETURN  Total
END FUNCTION

Similar Messages

  • Why parameters stopped to working - Case SSRS on native mode migrated to SQL Server 2014

    We had SQL Server 2008 Reporting Service on Native mode. We had hyperlink including date parameters in Intranet. When you click the link, you get report opened with correct date filtering.
    We have created new SQL Server 2012 Reporting Server environment. We have migrated reports there. However when clicking hyperlink, we don't get report filtered by days.
    Why paratemeters are not working anymore? Is there something to configure?
    http://000.000.00.000/Reports_ABCREPORTS/Pages/Report.aspx?ItemPath=%2fMircrosoft+PROD%2fSelectEventsGroup&rs:Command=Render&EventInfo=maindata&DayLimit1=10.6.2014
    12:12:45&DayLimit2=10.6.2014 12:31:10
    Kenny_I

    Hi Kenny_I,
    Have you migrated all reports from SSRS 2008 to SSRS 2012, including the drill-through report? As per my understanding, I think this issue can be caused drill-through report couldn’t be accessed in the new environment or the report had been changed. Please
    make sure the drill-through report works well in the new environment. We can directly render the drill-through report with the Parameter values @EventInfo=maindata, @DayLimit1=10.6.2014 12:12:45 and @DayLimit2=10.6.2014 12:31:10 to check the report.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Why does abode not work on my galaxy tab2

    Why does abode not work on my galaxy tab 2?

    The games dont load they just say I need to update to the latest version or say that it is not compaterble with it.

  • Why does sound not work on my Mac Air?

    Why does sound not work on my Mac Air --all setting seem okay. OSX 10.9.2 operating systyem.

    Open System Preferences > Sound > Output
    Make sure the coorect output devices is selected and the Mute button is not checked.

  • Why youtube dose not work on my macbook pro 10.6.6?

    why youtube dose not work on my macbook pro 10.6.6 ?

    Double check you have the latest version of Adobe Flash.

  • Not sure why Message is not working on my ipad.

    Not sure why message is not work on my iPad. It works find on my iPhone.

    http://support.apple.com/kb/TS2755

  • I have an older iMac 5,1 and the disc drive no longer works. I was hoping that I could the Apple USB super drive as a replacement, but the info on the super drive page says compatible with iMac 2012 or later. Does anyone know why it would not work for me?

    I have an older iMac 5,1 and the disc drive no longer works. I was hoping that I could the Apple USB super drive as a replacement, but the info on the super drive page says compatible with iMac 2012 or later. Does anyone know why it would not work for me?

    A reply to similar question (Q & As , in product page Apple Store) says:
    "...dissable the internal reader hardware from devices setup. Then plug the external usb superdrive and that's it."  Answered by Enrique T from Lima Oct  25 2013.
    If you can locate an external Apple USB 'Air" superdrive for earlier model MacBook Air, that should work. The newer one for the Air is the same as for iMac, now.
    You may be able to use other brands of external USB optical drive with your older intel-based iMac, as some of them function capably. A few should also be able to see system discs or other bootable utilities on DVD.
    Hopefully this helps.
    Good luck & happy computing!

  • Why it is not working?

    hai all,
    i am new to jsp. please help me with the necessary corrections of the code given below.
    <%@ page import="java.io.*, java.sql.*" %>
    <%
         ResultSet rs;
         Class.forName("oracle.jdbc.driver.OracleDriver()");
         Connection Con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.x.xx:1521:new","old","new");     
         Statement st=Con.createStatement();
    %>
    why it is not working
    Thanks in advance.
    by
    ramki.

    I think you have to put the variables definition (rs, st, con...) in a specific place like this, i mark with (*) what i changed:
    <%! (*)
    ResultSet rs; (*)
    Connection Con; (*)
    Statement st; (*)
    %> (*)
    <% (*)
    Class.forName("oracle.jdbc.driver.OracleDriver()");
    Con=DriverManager.getConnection ("jdbc:oracle:thin:@192.168.x.xx:1521:new","old","new");
    st=Con.createStatement();
    %>
    good luck,
    javi

  • Why facetime does not working with any carrier in u.s expect att although the iphone is factory unlocked

    why facetime does not working with any carrier in u.s expect att although the iphone is factory unlocked

    Facetime only works via WiFi. Are you trying to set up Facetime with a T-Mobile account?

  • Why ps3 is not working well with airport

    why ps3 does not work well wth the airport?

    If you are referring to online gaming, then PS3 like all non-apple devices uses upnp to open ports.
    Apple uses NAT-PMP to open ports.. East and West.. never the twain shall meet.
    If it is internal wireless issues.. that is different.. airport should be just like any other wireless router.
    If you tell us the issue we have more hope to help.

  • HT202853 I have many project made in move HD that are not updating to the new iMovie 10 on my new iMac.  Why is this not working as stated?  How do I get my projects back from backup after old iMac crashed?

    I have many projects made in imovie HD that are not updating to iMovie 10 on my new iMac.  Why is this not working as stated on the article HT202853?  How do I get my projects back from backup after old iMac crashed?

    According to:
    Update projects and events from previous versions of iMovie in iMovie (2014) - Apple Support
    you can update from iMovie versions 7, 8 and 9, but iMovie HD is iMovie 6.
    Maybe you can update in two steps, first from iMovie 6 to iMovie 7, 8 or 9 then to iMovie 10. 
    Geoff.

  • I re- start my ipad2 into a new one,to update into i0s7, why it is not working of loading?

    I re- start my ipad2 into a new one,to update into i0s7, why it is not working of loading? please help!!!

    The [c:set|http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html] tag is used to set a scoped attribute not request parameter. So when you write
    <sql:param value="${param.userid}" />You get null as there is no parameter named userid in the request. Try this
    <sql:param value="${userid}" />I would recommend you not to do database connectivity stuff in JSP, JSPs are the view layer of an application and they aren't supposed to be for doing business logic. Also since you are using a random userid, you might end up with multiple users with the same ID and IDs are generally supposed to be unique...

  • TS3297 I want to buy the double coins from the game subway surfers! But they told me to contact the itunes support! I don't know why it's not working.. Please help! iPhone 4ss

    I want to buy the double coins from the game subway surfers! But they told me to contact the itunes support! I don't know why it's not working.. Please help! iPhone 4ss

    These are user-to-user forums, you are not talking to Apple here. You can contact iTunes support via this page and ask them why the message is appearing : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then probably Purchases, Billing & Redemption

  • Cant restore iphone 3g 4.2.1 it would load half way threw then say unknown error why it is not working?

    cant restore iphone it would loa half way threw then say unknown error why is it not working and its a iphone 3g 4.2.1

    What is the exact error message you're getting?

  • No earbuds work for the left side...why dis it not working?

    My sons and husbands iphones work just fine with earbuds that dont work on mine. Why is mine not working? Earbuds used to work but not anymore.

    Melinda1933 wrote:
    It couldnt be that cause they work just fine on my hisbands iphone. Im wondering if it can even be fixed! But its nothing i can fix with teouble shooting. Thanks though.
    Read my post again
    CHECK the earphone socket on YOUR iPhone
    The small round hole on top on left that is where the earphones are not working of course they work on
    another iPhone that is not the one wityh a problem
    If it is not debris it could be software  do the troubleshooting ..........

Maybe you are looking for

  • No "Real Instruments" Listed

    I have had my iBook for about a month and use GarageBand a lot. Then I went on and wanted to record something and there was nothing listed under "Real Instruments." Is this permanent or is there a way to get the recording styles listed. I hope someon

  • CRIO application works in interactive mode but broken VIs reported in error log when run built application on target

    I have been getting more than my fair share of grey hairs the past few days because of this. Over the past few months this almost never happened. Lately, after a seemingly minor change to some serial communications code, hardly a single build works w

  • Shiping labels print from LM19 Transaction in WM

    Hi all, This is regarding shipping labels print from RF transaction LM19. How it can be done? I saw in some document that we can do it with the user exit provided by SAP, Which is accessed by function module LE_MOB_PRINT. Please let me know the proce

  • How to Chinese enable the current Eng. SAP R/3  for our China subsidiary

    Hi There, I am to plan for an implementation to Chinese enable the English-only SAP R/3 ERP and SAP BW3.5 for our China subsidiary.  Requirement : we want to keep one single SAP system used by the whole group (China and the rest of the world), but we

  • System requirements for Final Cut Studio 2

    Hello. Can anyone help please? There's a  Final Cut Studio 2 that I have been offered to purchase, and I would like to go for it, only I'm not sure my machine will install it. The machine is this: Model Name:    MacBook Pro   Model Identifier:    Mac