CountDistinct Expression help
I have a Crystal expression If DistinctCount(Wolinenumber),(invoiceid) > 1 then " SEE BELOW" else (Releasenote) and i converted it to an SSRS expression.
=iif (CountDistinct(First(Fields!WOLINENUMBER.Value,
"DataSet1"),First(Fields!INVOICEID.Value,
"DataSet1")> 1,"SEE
BELOW",First(Fields!RELEASENOTE.Value,
"DataSet1"))
When i run my report i get an error as Textrun[0]` has an incorrect number of parameters for the function 'CountDistinct'
Can someone correct it for me ?
Thank youFM
May 25th, 2011 2:44pm
There can be only one parameter for CountDistinct function, you got two which is why you see the error.
Free Windows Admin Tool Kit Click here and download it now
May 25th, 2011 3:03pm
what are they ? Can you point them out ?FM
May 25th, 2011 3:47pm
It's the same as T-SQL. Whatever you want to count goes into the function. For example:
CountDistinct(First(Fields!INVOICEID.Value, "DataSet1"))
Free Windows Admin Tool Kit Click here and download it now
May 25th, 2011 3:50pm
Hi Farhan1,
The First function returns the first value in a set of data after all sorting and filtering have been applied at the specified scope, the CountDistinct function returns a count of all distinct non-null values specified by the expression and evaluated in the
context of the given scope. Only a function can be used in the expression(For example: CountDistinct(First(Fields!INVOICEID.Value, "DataSet1"))).
Based on your requirement, you can use the DISTINCT keyword in the query to eliminate repetitive data, and then try to use the expression below:
=IIF(First(Fields!WOLINENUMBER.Value,”DataSet1”)>1 and First(Fields! INVOICEID.Value, "DataSet1")>1,”SEE BELOW”, First(Fields!RELEASENOTE.Value, "DataSet1"))
If you have any question, please feel free to ask.
Thanks,
Bin Long
May 27th, 2011 5:18am