Solved

I have a crystal percentage formula issue

Posted on 2014-07-21
5
290 Views
Last Modified: 2014-07-25
I want the this formula to return a %.  Like 14%,  It comes back now 0.14%

if Sum ({@Cashless}, {points_of_sale.code}) = 0 then
    0
else

if Sum ({Vend_Visits.total_revenue}, {points_of_sale.code}) = 0 then
    0
else

Sum ({@Cashless}, {points_of_sale.code})/Sum ({Vend_Visits.total_revenue}, {points_of_sale.code})
0
Comment
Question by:evend
  • 2
5 Comments
 
LVL 8

Expert Comment

by:5teveo
ID: 40210653
Try this syntax... here is a sample of syntax

Sum({orders.AMOUNT}, {orders.DATE}, "monthly") % Sum({orders.AMOUNT })

Groups values in the Amount field by month, and calculates the sum of the values for each month group as a percentage of the sum of the values for the entire report.
0
 
LVL 34

Accepted Solution

by:
James0628 earned 445 total points
ID: 40211183
As he posted, you can use the % operator.  Or you could multiply the result by 100.  The % operator is just a shortcut that CR provides.  X % Y is the same as X / Y * 100

 FWIW, you don't need to test Sum ({@Cashless}, {points_of_sale.code}) to see if it's 0.  If it is, the result will just be 0.  There's no harm in checking it, of course.  But it's not necessary.

 James
0
 

Author Closing Comment

by:evend
ID: 40218353
Thanks!  Multipying by 100 was easy.
0
 
LVL 34

Expert Comment

by:James0628
ID: 40219027
You're welcome.

 But, to be fair, 5teveo probably should have gotten some of the points.  His basic suggestion to use the % operator was valid, although his use of different fields in his example formula, and then explaining what that formula was doing, was kind of confusing (at least to me).  So, it may be something of a gray area.  But he did have the % operator in there.

 If you like, you can use the "Request Attention" link to ask to have the question re-opened, and then split the points between us.

 James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now