Exporting to Excel using 2014 SSRS not calculating correctly total seems to double

  • Hello

    Custom Code

    Public Shared Value as Integer=0Public Shared Function GetValue(Item as Integer) as Integer

    value= value + Item

    return Item

    End Function

    Public Shared Function GetTotal()

    return value

    End Function


    On the row to store the numbers I here is my code -

    =Code.GetValue(IIF(IsNothing(Lookup(Fields!CustomerName.Value, Fields!Customer_Name.Value, Fields!BudgetPeriod.Value, "DataSetSQL_Budget")),0, Lookup(Fields!CustomerName.Value, Fields!Customer_Name.Value, Fields!BudgetPeriod.Value, "DataSetSQL_Budget")))

    Finally on the total row I input the total using

    =Code.GetTotal()


    Now it works perfect I can see the totals on the screen and print it on pdf perfectly, but when exporting to Excel the total is incorrect.  I believe it has to do something with pages in Excel.  Any help will be appreciate.  Thank you in advance.

  • In general, you should let grouping in SSRS take care of calculating totals.  Using custom code should be avoided for that kind of purpose.   Better yet, calculate your totals in your query for your dataset, and then all you need to do is display rows.   Alternatively, a matrix or tablix can do the grouping work for you and all you need to select is the raw data.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Yeah,  in my case it's not really possible.  Thanks anyways

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply