Sum Values Returned From LookupSet Function

Posted By Posted by: EPM Partners on March 13, 2013

The LookUpSet function returns objects or array of objects.

Cannot use the default SUM function to sum the values returned.

The following VB script needs to be added as a function in the report (Report > Report Properties > Code)

Public Function SumLookup(ByVal items As Object()) As Decimal

Dim suma As Decimal = 0

For Each item As Decimal In items

suma += item

Next

Return suma

End Function

Then in the expression use Code.SumLookup(<lookupset function>)

Note*:

  • Please reference my previous blog here regarding using VB script in SSRS reports
  • Please reference my previous blog here regarding using the lookupset function

Blog Posted In Blog Posted In: How to
Blog Posted In 

Leave a Reply

Your email address will not be published. Required fields are marked *