none
ReportViewer SUM Aggregate function shows #ERROR RRS feed

  • Question

  •  

    I am displaying a field in a Table Body Column in a ReportViewer called UnitPrice that is a float type in the database and a Double in the Dataset. (I populate the Report Datasource with a Dataset from a WebService call)

     

    In the Table Footer I add the following in the Expression

    =Sum(Fields!UnitPrice.Value, "dsProduct_dtProductList")

     

    When the Report shows the Table Column shows perfectly but the SUM function in the Table footer Displays #Error

     

    I am using Microsoft Visual Studio 2005
    Version 8.0.50727.42  (RTM.050727-4200)
    Microsoft .NET Framework
    Version 2.0.50727

    Installed Edition: Enterprise

    Microsoft Visual C# 2005   77718-007-4000003-41087

    Any advice will be appreciated

     

    Thanks

    Christo

    Saturday, September 22, 2007 9:53 PM

Answers

  • Sounds like the UnitPrice field might a string datatype, not a double or other numeric datatype.

    Try this expression to cast the value:

    =Sum( CDbl(Fields!UnitPrice.Value, "dsProduct_dtProductList"))

     

    -- Robert

    Tuesday, September 25, 2007 10:10 PM
    Moderator

All replies

  • If one of your values in your column is empty/null it will throw an error. This may be the problem.
    Monday, September 24, 2007 8:59 PM
  • Hi Christo,

     

    In spite of what the other post says, I don't think this is a null-ishproblem (you can sum with nulls, usually) -- you probably need to cast the value inside the SUM. 

     

    >L<

     

     

     

    Tuesday, September 25, 2007 3:46 PM
  • Sounds like the UnitPrice field might a string datatype, not a double or other numeric datatype.

    Try this expression to cast the value:

    =Sum( CDbl(Fields!UnitPrice.Value, "dsProduct_dtProductList"))

     

    -- Robert

    Tuesday, September 25, 2007 10:10 PM
    Moderator
  • Robert Bruckner' solution has worked for me.

    Guys, this stupid error it's due a Double conversion

     

    here is my formula:

     =SUM(IIF(Fields!SegurosTransaccion.Value.Equals("N/B") , Fields!Ganancia.Value - (Fields!Ganancia.Value*.20) , Fields!Ganancia.Value)))"N/B") , Fields!Ganancia.Value - (Fields!Ganancia.Value*.20) , Fields!Ganancia.Value)

     

     

    this is the solution:

    =SUM(IIF(Fields!SegurosTransaccion.Value.Equals(

    "N/B") , cdbl(Fields!Ganancia.Value - (Fields!Ganancia.Value*.20)) , cdbl(Fields!Ganancia.Value)))

     

    "N/B") , cdbl(Fields!Ganancia.Value - (Fields!Ganancia.Value*.20)) , cdbl(Fields!Ganancia.Value)))
     
    "N/B") , Fields!Ganancia.Value - (Fields!Ganancia.Value*.20) , Fields!Ganancia.Value))
    • Edited by abarberena_gil Saturday, February 26, 2011 5:16 AM extra line
    Saturday, February 26, 2011 5:08 AM
  • i wrote this

    =Sum( Val(Fields!UnitPrice.Value), "dsProduct_dtProductList")

    or

    =Sum( Val(Fields!UnitPrice.Value))

    and it works to me

    Wednesday, October 15, 2014 11:31 PM
  • thank you sir...it was helpful
    Friday, April 7, 2017 7:13 AM