Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Crystal reports formula

Posted on 2011-09-23
8
320 Views
Last Modified: 2012-06-27
Hello,

I have a formula that is not working.  This formula is returning a value of 0 when it should be 0.19.

(DistinctCount ({qryCOQ.CSIID}, {qryCOQ.CSIIssueDepartment}))/(DistinctCount ({qryCOQ.JobNumber}, {@Date}, "monthly"))

I ran each section by itselt and the results were:

DistinctCount ({qryCOQ.CSIID}, {qryCOQ.CSIIssueDepartment})  = gave me 16
DistinctCount ({qryCOQ.JobNumber}, {@Date}, "monthly") = gave me 84.

Maybe I need to use the EvaluateAfter() command?  I tried it though, and it gave me zero also.  I might not be using it right.  

Thanks,
Joel
0
Comment
Question by:Genius123
  • 4
  • 2
  • 2
8 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 36591143
You are doing integer division

(CDbl(DistinctCount ({qryCOQ.CSIID}, {qryCOQ.CSIIssueDepartment})))/(DistinctCount ({qryCOQ.JobNumber}, {@Date}, "monthly"))

Another thought is check the formatting to ensure you aren't formatting with 0 decimals or rounding to 0 decimals

mlmcc
0
 

Author Comment

by:Genius123
ID: 36591398
It was the number of decimals.  You are the man.  Or woman?!

Thanks,
Joel
0
 

Author Comment

by:Genius123
ID: 36599438
I've requested that this question be closed as follows:

Accepted answer: 0 points for Genius123's comment http:/Q_27325309.html#36591398

for the following reason:

Thanks.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 34

Expert Comment

by:James0628
ID: 36591998
mlmcc,

 I know that this may not be important, since it wasn't the problem, but why did you say that his formula was integer division?  Am I missing something?


 Genius123,

 If you got the idea to check the number of decimals from mlmcc's post, then you should accept his post as the solution and award him the points.  If you found it on your own before you saw his post, then you should mention that, just so that we know (of course you could still award him the points for trying to help, but that's up to you).

 James
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36592889
It was just a thought since they were both counts and integers.  I have been doing a lot of VB programming and then it matters.  Crystal probably handles it differently.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 36592919
CR doesn't make the result of a calculation integer just because the values in the calculation are integers.  I thought just maybe I was missing something, like maybe using DistinctCount in the calculation was affecting the results, but I don't think so.

 James
0
 

Author Comment

by:Genius123
ID: 36599439
Accidentally closed.
0
 

Author Closing Comment

by:Genius123
ID: 36599442
It was the number of decimals.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question