Aggregate as Custom Code
Hi, I have the following code for an expression to find the difference between two rows of data: Last(Fields!amount.value) - First(Fields!amount.value) I would like to find the sum of the expression above but you cannot have can aggregate inside an aggregate. Sum(Last(Fields!amount.value) - First(Fields!amount.value)) Is there any custome code I can make for the expression Last(Fields!amount.value) - First(Fields!amount.value)And then do Sum(code.Difference(Fields!amount.value))Any help would be greatly appreciated!!Dan
August 20th, 2012 4:24pm

Hi there Thanks for your posting again. Please do the following You need to write the following code inside your report 1.Create the following function inside your report by going to report properties and go to the code section Dim public totalBalance as decimal=0 Public Function AddTotal(ByVal Column1 AS decimal, ByVal Column2 AS decimal) AS decimal totalBalance = totalBalance + ( Column1- Column2) End Function Public Function GetTotal() return totalBalance End Function Dim public totalBalance as decimal=0 Public Function AddTotal(ByVal Column1 AS decimal, ByVal Column2 AS decimal) AS decimal totalBalance = totalBalance + ( Column1- Column2) End Function Public Function GetTotal() return totalBalance End Function Create another column inside your report and put this expression = code. AddTotal (Last(Fields!amount.value), First(Fields!amount.value)) Add this expression where you would like to get the total sum =code. GetTotal () You are done If you have any questions please do ask. Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2012 5:20pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics