Search code examples
reporting-servicesssrs-2008ssrs-2008-r2

SSRS How to Add Max Expression to an Existing Expression


I have the following code and I now want to only show the max or distinct values for a single field within SSRS.

=Join(LookUpSet(Fields!Baseacctnbr.Value, 
Fields!Baseacctnbr.Value, 
Fields!Acctnbr.Value, 
"DataSet1"), ",")

Right now with this expression the code brings back all the accounts, but it brings back multiples of the same account because of the SQL query and other data that is needed. I would like to only show the MAX or Distinct values of the AcctNbr on a single field within SSRS.

Is there a way to add the MAX expression to this existing expression?

UPDATE: When I add the SSRS Code Block found on another question, then I receive an error message that states: "Too many arguments to 'Public Shared Function RemoveDuplicates(m_Array() As Object) As String()."

Thanks.


Solution

  • I removed the close brace and it worked fine. I had also entered this code before your response and it worked fine since the account is actually 8 characters long.

    =Join(Code.RemoveDuplicates(LookupSet(Left(Fields!BaseAcctNbr.Value, 8), Fields!BaseAcctNbr.Value, Fields!AllPhase3AcctNbrs.Value, "DataSet1")), ",")
    

    Thanks for your help!