Solved

I have a crystal percentage formula issue

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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. …
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

16 Experts available now in Live!

Get 1:1 Help Now