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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinctcount Shows Wrong Result 2

Status
Not open for further replies.

codrutza

Technical User
Mar 31, 2002
357
IE
CR XI

Please help me with this:

I try to make a manual cross tab;

In record selection formula I have {@DepLoc} startswith ["Ag","Bu","Ge","Sh","Vu"]
and {@ArrLoc} startswith ["Fos","Rot","Nor"]

In the manual cross tab I have "Ag","Bu","Ge","Sh","Vu" on horizontal and "Fos","Rot","Nor" on vertical

I have for example for Ag/Fos formula @AgFos: if distinctcount(jobsAgFos)<> then sum(@daysbetweendepartureandarrivalAgFos) /distinctcount(jobsAgFos) else 0

For some locations I have no jobs; why for these appears at distinctcount 1, where it should be 0? And in the same time, why at @AgFos appears distinctcount with 1 jobs more? It ruins my formulas [sad]

I must doing something wrong....

 
This happens when you do a distinct count of an IF-THEN. You have to make sure you specify a NULL value as your else or the value you use (like empty string) will count as one more value. This link explains in more detail how to get a CR formula to return a null:


Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top