Sum function not working properly.

5 posts, 1 answers
  1. Muhammad
    Muhammad avatar
    27 posts
    Member since:
    Oct 2017

    Posted 05 Jan 2018 Link to this post

    Hi there

    I'm working on a report in which I have to take Sum of a field, I'm using this expression right now. =Sum(Fields.ReceivedAmount).
    This expression works fine in Standalone reporting tool but when I apply the same thing over Reporting in Visual Studio all I get is the result shown in the attached picture. 
    Can somebody help me out please if there is something out of the box needs to be done in here ?

    Thank you
  2. Silviya
    Admin
    Silviya avatar
    380 posts

    Posted 05 Jan 2018 Link to this post

    Hi Muhammad,

    Telerik Reporting is using the same engine in order to create full-featured report definitions. So, it have to be some differences between the report definitions used in Standalone Report Designer and Visual Studio Report Designer that produces different output when the report is rendered.

    Based on the provided screen shot, I assume that the data field type in this report definition is set to String, because it looks like they are concatenated with the SUM() aggregate function.
    In order to avoid it, I can suggest to use conversion function CDbl(expression) to convert the field values to Double. But if it possible to change configuration of the DataSource, you can change the type of the column there.

    Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Muhammad
    Muhammad avatar
    27 posts
    Member since:
    Oct 2017

    Posted 06 Jan 2018 in reply to Silviya Link to this post

    Hello Silviya, 

    Thank you for your prompt response. I tried your proposed solutions and I also double checked the data types in the database as well. Now what I did to achieve the calculated amount is to use the SUM function in the query and now I am getting my solution but there is also a point where I have to calculate the entire row and it can;t be done in query because I can't use Sum inside another SUM or something like that. It would've been better if this worked. 
    Anyways Thank you if you have any other solution please do help me out it will really help me 

    Thanks
  4. Answer
    Silviya
    Admin
    Silviya avatar
    380 posts

    Posted 10 Jan 2018 Link to this post

    Hi Muhammad,

    You are right, by default, Telerik Reporting does not supports nested aggregate functions.

    If I understand right you have to calculate the row sum values. If so, I can suggest you to use Crosstab data item in order to display aggregated data summaries, grouped in rows and columns. 

    An example Crosstab and its properties can be found at the bottom of the Understanding Crosstab Areas help article.

    Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Muhammad
    Muhammad avatar
    27 posts
    Member since:
    Oct 2017

    Posted 09 Feb 2018 in reply to Silviya Link to this post

    Thank you for your response Silviya. I got what I needed.

    Best, 
Back to Top