Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct Count of two fields 1

Status
Not open for further replies.

Drepso

Technical User
Jul 22, 2002
50
AU
Hi,

I would like some help to calculate a distinct count of two fields.

The two fields I would like to calculate a distinct count of are:
CASE_NO
VEHICLE_NO

I would like to group these by location so I have placed the following formula in the group header:

DistinctCount({CASE_NO},{LOCATION})

I need to change this formula to only do a distinct count when the CASE_NO and VEHICLE_NO fields are unique.

I have tried many alternatives but cannot get the formula to work. Any assistance is greatly appreciated.

Cheers,
Drepso
 
Try creating a formula:

{table.CASE_NO}+{table.VEHICLE_NO}

And use the formula in your distinctcount formula.

If this doesn't help, try posting technical information instead:

Crystal version
database used
Example data
Expected output

-k
 
Thanks SV
Your a champion!
cheers
Drepso
 
SV,

I am now having trouble calculating a distinct count based on a condition.

I have created a formula called @Case_Vehicle and would like to perform a distinct count of this field when Table.C_Area is equal to 1.

I have tried the following formula:

DistinctCount (@Case_Vehicle , table.c_area, "1")

but I get the error message the summary/total field could not be created.

Any help with the above is appreciated.

Cheers
D
 
If you have Crystal 8.5, try creating a running total, this includes distinct count and also a formula to let you choose what to include.

Madawc Williams
East Anglia, Great Britain
 
Thanks for your reply Madawc

I do have Crystal 8.5, I created a running total but I need to place this calculation in my report header.

The running total is only returning the value for the first record for the report.

Is there any other way to achieve this?

Thanks again in advance

Cheers,
d
 
Drepso: Note that I'd asked that you supply technical information, which you've not done, hence the ongoing thread as we slowly milk requirements from you, or you go thro8ugh your own discovery process.

Crystal version
database used
Example data
Expected output

Here you reference a formula you've created, but you don't share what's in the formula, which will often lead to more questions, not solutions.

Please take the time to flesh out your environment and requirements. Someone will likely try to help you anyway, but if the majority of the technical information is gleened as a result of asking the same questions repeatedly without a response, or you slowly unfurl new requirements because you didn't want to take the time to explain it all, I'll lose interest, as will many here.

Now that I've wasted some of your time and pciked on ya a bit ;):

Try a formula which always returns a result, such as:

If {table.field} = "something" then
1
else
0

This should allow you to do a count of it, providing your condition lends itself to a distinct count, you should be fine. You're the only one who knows that right now though.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top