Solved

The remaining text does not appear to be part of the formula error

Posted on 2016-11-13
2
29 Views
Last Modified: 2016-11-13
Crystal Reports 2016

I have a formula where I want to sum a field based on a Datetime field called E911Data.EntryDateTime using a parameter value -1 to get the records from the previous year then that of the year contained in the parameter.

I get a The remaining text does not appear to be part of the formula error after sum({E911Data.Agency}).  What is causing this error?


sum({E911Data.Agency}) where Year({E911Data.EntryDateTime}) = {?Pm-?Year} -1
0
Comment
Question by:MikeM670
2 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 41885798
Crystal doesn't have a WHERE clause on the sum

To do this you need 2 formulas

Value Formula
Name - PreviousYearValues
If  Year({E911Data.EntryDateTime}) = {?Pm-?Year} -1  then
    {E911Data.Agency}
Else
     0

Open in new window


The second formula does the sum
Name - SumPreviousYear
Sum({@PreviousYearValues})

Open in new window


Create both formulas
Put the SUM formula on the report where you need the sum displayed.  The other formula doesn't have to be on the report.

Another way to do this would be to drop the value formula on the report
YOu can then RIGH CLICK it and select summary
Set up the summary as a sum and put in the footers where you want it

mlmcc
0
 

Author Closing Comment

by:MikeM670
ID: 41885809
Thanks.  I did not realize you could not use a Where clause with a Sum().  Sometimes I tend to test things in sql before crystal.
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. …
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 …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

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

16 Experts available now in Live!

Get 1:1 Help Now