none
HOw to get seperate total only for particular columns/rows

    Question

  • Hi All,

    when i take row total it adds total for all division

    but my problem is to get the total of only four divisions when i expand total


    vandana

    Thursday, April 04, 2013 4:24 AM

Answers

  • Hi Vandnareddy,

    Maybe we can use custom code to calculate the total, when come to the division which you want to calculate, call the custom function. The sample custom code looks like below.
    Public Shared Value as Integer=0
      Public Shared Function GetValue(Item as Integer) as Integer
         value= value + Item
         return Item
      End Function
      Public Shared Function GetTotal()
         return value
      End Function

    Then in the cell which you want to calculate, type the expression below.
    =iif(fields!Division.Value="A" OR fields!Division.Value="B" OR fields!Division.Value="C" OR fields!Division.Value="D",Code.GetValue(iif(fields!Division.Value="A" OR fields!Division.Value="B" OR fields!Division.Value="C" OR fields!Division.Value="D",Fields!Amount.Value,0)),Fields!Amount.Value)

    Then use the expression to get the total.
    =Code.GetTotal()

    If you have any questions, please feel free to ask.

    Regards,


    Charlie Liao
    TechNet Community Support

    Tuesday, April 09, 2013 8:02 AM
    Moderator

All replies

  • Perhaps it is possible to get the data via T-SQL from the data set? Can you post the sample data?

    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

    Thursday, April 04, 2013 5:54 AM
  • Hi Vandnareddy,

    Maybe we can use custom code to calculate the total, when come to the division which you want to calculate, call the custom function. The sample custom code looks like below.
    Public Shared Value as Integer=0
      Public Shared Function GetValue(Item as Integer) as Integer
         value= value + Item
         return Item
      End Function
      Public Shared Function GetTotal()
         return value
      End Function

    Then in the cell which you want to calculate, type the expression below.
    =iif(fields!Division.Value="A" OR fields!Division.Value="B" OR fields!Division.Value="C" OR fields!Division.Value="D",Code.GetValue(iif(fields!Division.Value="A" OR fields!Division.Value="B" OR fields!Division.Value="C" OR fields!Division.Value="D",Fields!Amount.Value,0)),Fields!Amount.Value)

    Then use the expression to get the total.
    =Code.GetTotal()

    If you have any questions, please feel free to ask.

    Regards,


    Charlie Liao
    TechNet Community Support

    Tuesday, April 09, 2013 8:02 AM
    Moderator