Sum across Column on every row

Poh CS 1 Reputation point
2022-01-31T02:04:27.737+00:00

169742-screenshot-2022-01-31-095729.png

Hi Everyone!

I am checking if it is possible to do a sum across horizontally for my Raw Cost Column to show on Column 1,
for every row.
Currently i am using a custom code but doesnt seem to add up correctly on the 2nd row record onwards
Currently Raw Cost column is a complex calculation due to many modification done throughout the months and the SQL query contains almost 800 lines which is too much of a effort to review and change it.
Expression for the source column Raw Cost
"=
Code.Getvaluerawcost((IIF(
Fields!CostMonth.Value <=DateAdd("d",Reportitems!Length_Of_Job.Value,Reportitems!Est_Start_Date2.Value)
,Reportitems!Raw_Cost.value,0)))"

Code Snippet for getting the Total Horizontally in Column 1
Dim public nettotal_rawcost as Double
Public Function Getvaluerawcost (ByVal Proposed_Raw_Cost AS Double) AS Double
nettotal_rawcost = nettotal_rawcost + Proposed_Raw_Cost
return Proposed_Raw_Cost
End Function
Public Function Totalvaluerawcost()
return nettotal_rawcost
End Function

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,813 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Joyzhao-MSFT 15,566 Reputation points
    2022-01-31T07:01:32.93+00:00

    Hi @Poh CS ,
    If your Tablix is a matrix and you need to sum a field in the matrix, just select the field - Add Total - Column

    169814-02.jpg

    Preview:

    169668-03.jpg

    If I misunderstand what you mean, please feel free to correct me.
    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.