Symptom
There is a need to find the larger value for a mode in case of a tie between 2 mode values.
Environment
Crystal Reports 2008 V1
Reproducing the Issue
-
Create a Crystal report based on a supported data source.
-
Create a formula as "@Formula1" based on a field {field1} such as Mode({field1}).
-
Place the field {field1} in Details section of the report.
-
Place the formula "@Formula1" in Report Footer section of the report.
-
The output of the formula would be the lower number in case of a tie between 2 mode values.
Example:
DataSet (Field1): (1,4,4,2,2,3)
@Formula1: Mode({Field1}) i.e Mode(1,4,4,2,2,3)
Output: 2 (Mode Values: 2 and 4). The lower number is displayed as output.
Cause
In Crystal Reports, Mode always shows the lower number in case of a tie between 2 mode values.
Resolution
-
Create a formula as "@Formula1" based on a field {field1} such as NthMostFrequent(2,{field1}).
-
Place the formula in Report Footer section of the report.
-
The output of the formula would be the larger number in case of a tie between 2 mode values.
Example:
DataSet (Field1): (1,4,4,2,2,3)
@Formula1: NthMostFrequent(2,{field1}) i.e NthMostFrequent(2, (1,4,4,2,2,3)).
Output: 4 (Mode Values: 2 and 4). The larger number is displayed as output.
Keywords
Mode of a field, mode, larger value of mode, crystal reports, CR 2008 V1 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem