Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Help with Simple Sum Syntax Post Reply Post New Topic
Author Message
icheckout
Newbie
Newbie


Joined: 18 Apr 2010
Location: United States
Online Status: Offline
Posts: 15
Quote icheckout Replybullet Topic: Help with Simple Sum Syntax
    Posted: 21 Jun 2010 at 2:02pm
Thank you for looking at my post.
 
I need to calculate the total quantity of the field {Quantity} based on different names stored in a field called {Substitute}.
 
I have tried:
 
Sum ({Quantity},(where {Substitute}="Tube")
 
This does not work.  I get this error message:
 
"Running Total\Summary Field could not be created"
 
Could someone please send me the correct syntax to use for this formula?
 
Thank you,
Richard Scott
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 21 Jun 2010 at 7:37pm

you can group based on 'Substitute'.

and make a Sum based on this group.
 
typically --> sum({qty},[groupname])
 
 
 
hope it help.
 
Emir W
IP IP Logged
icheckout
Newbie
Newbie


Joined: 18 Apr 2010
Location: United States
Online Status: Offline
Posts: 15
Quote icheckout Replybullet Posted: 22 Jun 2010 at 1:23pm
Thank you for the reply.  Unfortunately I can't use groupson this report.
 
I have continued to tinker with the formula and the following formula comes close but it sums the total for all items:
 
If {ProductNumber.ProductNumber}='100049'
   then sum({LineItem.Quantity}) else 0
The problem with the above formula is that it SUMS all the Quantity for all items but I only want it to SUM the Quantity if the roductNumber=100049.
 
I think the formula should be like (doesn't work):
 
Sum({LineItem.Quantity}) where {ProductNumber.ProductNumber}='100049'
 
But I get the error message " The remaining text does not appear to be part of the formula" right before "where".
 
Does anyone know the syntax for a conditional SUM where it only SUMs the items the condition is based on?
 
Thanks,
Richard Scott
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Jun 2010 at 4:06pm
You cannot use a WHERE clause in these formulas
 
IMO the easiest solution is a series of Running Totals.
Right click on RTs and select New
Name=product100049 (or whatever)
field to summarize= {LineItem.Quantity}
Summary Type=SUM
Evaluate = Use a formula
{ProductNumber.ProductNumber}='100049'
Reset=Never
Place in Report Footer
 
You can make as many as you need for each product type and change the evaluate formula to match
IP IP Logged
icheckout
Newbie
Newbie


Joined: 18 Apr 2010
Location: United States
Online Status: Offline
Posts: 15
Quote icheckout Replybullet Posted: 22 Jun 2010 at 4:42pm
DBlank,
 
That works!  Thank you so much for the direction.   I was stuck and had the pressure of needing this report complete by Thursday morning.
 
I appreciate everyone's input in helping me solve this issue.
 
Thank you,
Richard Scott
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.