Solved

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

Posted on 2016-11-13
2
12 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

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…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

20 Experts available now in Live!

Get 1:1 Help Now