# Database Discussions > Reporting Services >  Subtotal calculated expression from hidden detail row to subtotal row.

## donalejandro

Hello,

I am using the one of latest version of SSRS (2013) I am having trouble to subtotal my fields to the subtotal row.  In the detail row I have 6 columns that uses calculated field the detail fields work fine I get the correct results, but I cannot subtotal I  used the following code for one of the columns on the Report code:

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

I use this code in the detail row for subtotaling =Code.GetValue(ReportItems!txtCurrentMTD.Value)

and in the subtotal field  =Code.GetTotal()

It works great, but I need to hide the detail row, when I do hide the detail row  I get $0 for the amount.  There has to be a way I can show the subtotal from calculated field when the detail row is hidden. I need a good solution I do not want to change the sql query it's to complex.  Any help will be really appreciate.  I am at the end of my rope.  Thank you in advance.

----------

