Solved

# Crystal Report XI - Distinct Count Where Table.Field = A

Posted on 2009-04-02

I'm trying to find a solution/formula where when the Table.Field1 = A, I can then get a DistinctCount from Table.Field2. I've tried If/Then statements and While/Do statements.

For instance, I'll create a Formula Field called @Example and put in the formula: If {Table.Field1} = A Then DistinctCount({Table.Field2}). It doesn't seem to add up correctly.

Then when I do the following, @Example - While {Table.Field1} = A Do DistinctCount({Table.Field2}), I get a loop error.

I've also created it where I just have @Example to be {Table.Field1} = A and then in the report itself have it do a distinct count; however, it's adding up the wrong field.

I want to total amount of Table.Field2 where Table.Field1 = A.

Thanks.