Solved

I have a crystal percentage formula issue

Posted on 2014-07-21
5
293 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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