how to Sum Report Items and Grand Total Problems in report viewer with VB.Net2010


  • Page1

    Column-A    column_B  TimeDiff   <---Datediff() Here i'd used this function

    a 2/05/12 00:00:00

    a 4/05/12 02:25:17

    a 6/05/12 01:45:55


    a 6/05/12 02:25:17

    a 7/05/12 02:25:17

    a)Total timeDiff   04:50:34   <--- Here I need 08:01:46

    B 2/05/12 00:00:00

    B 4/05/12 02:25:17

    B 6/05/12 02:25:55

    B)Total timeDiff   04:51:12

    Grand Total 09:39:46 <--i got it,But   12:52:58  <-here i need grand total. only report viewer last page.

    please help me...

    • Edited by Emalai Tuesday, August 07, 2012 9:55 AM please any one help me
    Friday, August 03, 2012 9:33 AM

All replies

  • HI Emalai !

    You might get the desired output using below expression;

    =ReportItems!Textbox1.Value + ReportItems!Textbox2.Value

    Please let me know if this doesn’t work for you. Hope I have answered you correctly.

    Thanks, Hasham Niaz

    Monday, August 06, 2012 8:47 AM
  • Thank you Very much Hasham Niaz,

    i got Error

    Error 1 The Value expression for the textrun ‘Textbox106.Paragraphs[0].TextRuns[0]’ refers to more than one report item.  An expression in a page header or footer can refer to only one report item

    and i'd used this coding


    First page don't got total,i got total only second page values and Group Footer First page values not continues to total of second pages,

    i need every group footer total values and Grand total

    Monday, August 06, 2012 9:30 AM
  • Please help me

    Report viewer Result page show below, here used row grouping and DayDiff column used DateDiff() function

    Page 1

    Column-A column-B DayDiff <--Here using DateDiff()

    a 2/05/2012 0

    a 4/05/2012 2

    a 6/05/2012 2

     Page 2

    a 8/05/2012 2

    a 11/05/2012 3

    a)Group DayDiff Total is 5 but i need total 9  <---Here using custom code, =code.GetValue() and Problem is not get my first page values

    b 13/05/2012 2

    b 15/05/2012 2

    b 19/05/2012 4

    b)Group DayDiff Total is

    then second page Grand total 13 but i need grand total is 17 and Grand total is show on only second page not first page 

    please help me 



    Tuesday, August 07, 2012 4:35 AM
  • Hi There

    Thanks for your posting. Can you please have a look in your custom code are you using

    Shared variable like this Public  Shared Total_Count_Sum As Integer = 0

    If you are using Shared variable like that please try to change this like

    Public  Total_Count_Sum As Integer = 0

    And see if it makes any difference, your code might look like this one

    Public  Total_Count_Sum As Integer = 0

    Public Function  Count _Sum(ByVal value As Integer) As Integer

        Total_Count_Sum = Total_Count_Sum + value


        Return value


    End Function


    =Code.Count _Sum(DateDiff("d",Fields!A.Value-Fields!B.Value))

     Now you are passing the above expression to your code and returning the same value back but it will keep adding the value inside the Total_Count_Sum.

    Now Please put this expression where you would like to get the sum

     =Code. Total_Count_Sum

    If you have any questions please do ask

    Many thanks

    Syed Qazafi Anjum

    Tuesday, August 07, 2012 4:50 AM
  • Hi Emalai,

    Sorry for the delay.

    From your description, you are designning a client report definition (.rdlc) file. Let's assume the name of the field placed in the Column_A is "Column_A" and the name of the field placed in "Column_B" is "Column_B", and then, I suggest that you refer to the following steps:

    1. Drag a Table control to the design surface.
    2. Place "Column_B" in the Details row.
    3. Add a parent group for the Details group, and set the group to group on the "Column_A" field.
    4. Right-click on the details row of the "TimeDiff" column, select "Add Total".
    5. Right-click on the textbox that contains "Column_A" field, and select "Add Total"-> "After".

    For more information, please refer to the following article:

    Besides, this question is probably better served by the Visual Studio Report Controls forum where the experts are more familiar with the ReportViewer control. For your convenience, I have included link below:

    Mike Yin

    Mike Yin

    TechNet Community Support

    Thursday, August 09, 2012 9:05 AM
  • Thank you very much,

    Sorry for the delay 

    i'd tried but not working because Time_Diff is not Field,It is add another one column in Right side I need total of every group footer please help me..

    Tuesday, August 14, 2012 10:29 AM
  • Hi Emalai,

    Thanks for your posting.

    I have unmarked my reply above since it didn't help you resolve the issue. Besides, I notice that you have created several threads with the same topic, I will merge them due to the duplicates. Thanks for your understanding.

    From your description, you use custom code to obtain the aggrate valuee as the nested aggreate function is not supported in SSRS. Based on the current information, I suggest that you refer to Robert's blog Using Group Variables in Reporting Services 2008 for Custom Aggregation. It should be helpful for you.

    Mike Yin

    Mike Yin

    TechNet Community Support

    Tuesday, August 14, 2012 11:16 AM
  • Sorry for delay,

    Right-click on the details row of the "TimeDiff" column, select "Add Total" this option not show "Add Total"

    Friday, August 24, 2012 1:46 PM